<!DOCTYPE html>
<html lang="zh" dir="ltr" class="client-nojs">
<head>
<title>标准库头文件 &lt;memory&gt;</title>
<meta charset="UTF-8">
<meta name="generator" content="MediaWiki 1.21.2">
<link rel="shortcut icon" href="../../../common/favicon.ico">
<link rel="stylesheet" href="../../../common/ext.css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" href="../../../common/site_modules.css">
<style>a:lang(ar),a:lang(ckb),a:lang(fa),a:lang(kk-arab),a:lang(mzn),a:lang(ps),a:lang(ur){text-decoration:none}#toc{display:none}.editsection{display:none}
/* cache key: mwiki1-mwiki_zh_:resourceloader:filter:minify-css:7:15cea3ec788a65b5187d4018eed543bf */</style>

<script src="../../../common/startup_scripts.js"></script>
<script>if(window.mw){
mw.config.set({"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"cpp/header/memory","wgTitle":"cpp/header/memory","wgCurRevisionId":72483,"wgArticleId":9530,"wgIsArticle":true,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":[],"wgBreakFrames":false,"wgPageContentLanguage":"zh","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"zh","wgMonthNames":["","1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"wgMonthNamesShort":["","1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"wgRelevantPageName":"cpp/header/memory","wgUserVariant":"zh","wgRestrictionEdit":[],"wgRestrictionMove":[]});
}</script><script>if(window.mw){
mw.loader.implement("user.options",function(){mw.user.options.set({"ccmeonemails":0,"cols":80,"date":"default","diffonly":0,"disablemail":0,"disablesuggest":0,"editfont":"default","editondblclick":0,"editsection":0,"editsectiononrightclick":0,"enotifminoredits":0,"enotifrevealaddr":0,"enotifusertalkpages":1,"enotifwatchlistpages":0,"extendwatchlist":0,"externaldiff":0,"externaleditor":0,"fancysig":0,"forceeditsummary":0,"gender":"unknown","hideminor":0,"hidepatrolled":0,"imagesize":2,"justify":0,"math":1,"minordefault":0,"newpageshidepatrolled":0,"nocache":0,"noconvertlink":0,"norollbackdiff":0,"numberheadings":0,"previewonfirst":0,"previewontop":1,"quickbar":5,"rcdays":7,"rclimit":50,"rememberpassword":0,"rows":25,"searchlimit":20,"showhiddencats":0,"showjumplinks":1,"shownumberswatching":1,"showtoc":0,"showtoolbar":1,"skin":"cppreference2","stubthreshold":0,"thumbsize":2,"underline":2,"uselivepreview":0,"usenewrc":0,"watchcreations":0,"watchdefault":0,"watchdeletion":0,
"watchlistdays":3,"watchlisthideanons":0,"watchlisthidebots":0,"watchlisthideliu":0,"watchlisthideminor":0,"watchlisthideown":0,"watchlisthidepatrolled":0,"watchmoves":0,"wllimit":250,"variant":"zh","language":"zh","searchNs0":true,"searchNs1":false,"searchNs2":false,"searchNs3":false,"searchNs4":false,"searchNs5":false,"searchNs6":false,"searchNs7":false,"searchNs8":false,"searchNs9":false,"searchNs10":false,"searchNs11":false,"searchNs12":false,"searchNs13":false,"searchNs14":false,"searchNs15":false,"gadget-MathJax":1,"gadget-ColiruCompiler":1});;},{},{});mw.loader.implement("user.tokens",function(){mw.user.tokens.set({"editToken":"+\\","patrolToken":false,"watchToken":false});;},{},{});
/* cache key: mwiki1-mwiki_zh_:resourceloader:filter:minify-js:7:258d7cd6aa9aa67dee25e01fb6a9e505 */
}</script>
<script>if(window.mw){
mw.loader.load(["mediawiki.page.startup","mediawiki.legacy.wikibits","mediawiki.legacy.ajax"]);
}</script>
<style type="text/css">/*<![CDATA[*/
.source-cpp {line-height: normal;}
.source-cpp li, .source-cpp pre {
	line-height: normal; border: 0px none white;
}
/**
 * GeSHi Dynamically Generated Stylesheet
 * --------------------------------------
 * Dynamically generated stylesheet for cpp
 * CSS class: source-cpp, CSS id: 
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 * --------------------------------------
 */
.cpp.source-cpp .de1, .cpp.source-cpp .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;}
.cpp.source-cpp  {font-family:monospace;}
.cpp.source-cpp .imp {font-weight: bold; color: red;}
.cpp.source-cpp li, .cpp.source-cpp .li1 {font-weight: normal; vertical-align:top;}
.cpp.source-cpp .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}
.cpp.source-cpp .li2 {font-weight: bold; vertical-align:top;}
.cpp.source-cpp .kw1 {color: #0000dd;}
.cpp.source-cpp .kw2 {color: #0000ff;}
.cpp.source-cpp .kw3 {color: #0000dd;}
.cpp.source-cpp .kw4 {color: #0000ff;}
.cpp.source-cpp .co1 {color: #909090;}
.cpp.source-cpp .co2 {color: #339900;}
.cpp.source-cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp.source-cpp .es0 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es1 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es2 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es3 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es4 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es5 {color: #008000; font-weight: bold;}
.cpp.source-cpp .br0 {color: #008000;}
.cpp.source-cpp .sy0 {color: #008000;}
.cpp.source-cpp .sy1 {color: #000080;}
.cpp.source-cpp .sy2 {color: #000040;}
.cpp.source-cpp .sy3 {color: #000040;}
.cpp.source-cpp .sy4 {color: #008080;}
.cpp.source-cpp .st0 {color: #008000;}
.cpp.source-cpp .nu0 {color: #000080;}
.cpp.source-cpp .nu6 {color: #000080;}
.cpp.source-cpp .nu8 {color: #000080;}
.cpp.source-cpp .nu12 {color: #000080;}
.cpp.source-cpp .nu16 {color:#000080;}
.cpp.source-cpp .nu17 {color:#000080;}
.cpp.source-cpp .nu18 {color:#000080;}
.cpp.source-cpp .nu19 {color:#000080;}
.cpp.source-cpp .ln-xtra, .cpp.source-cpp li.ln-xtra, .cpp.source-cpp div.ln-xtra {background-color: #ffc;}
.cpp.source-cpp span.xtra { display:block; }

/*]]>*/
</style><!--[if lt IE 7]><style type="text/css">body{behavior:url("/mwiki/skins/cppreference2/csshover.min.htc")}</style><![endif]--></head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-cpp_header_memory skin-cppreference2 action-view cpp-navbar">
        <!-- header -->
        <!-- /header -->
        <!-- content -->
<div id="cpp-content-base">
            <div id="content">
                <a id="top"></a>
                <div id="mw-js-message" style="display:none;"></div>
                                <!-- firstHeading -->
<h1 id="firstHeading" class="firstHeading"><span style="font-size:0.7em; line-height:130%">标准库头文件</span> &lt;memory&gt;</h1>
                <!-- /firstHeading -->
                <!-- bodyContent -->
                <div id="bodyContent">
                                        <!-- tagline -->
                    <div id="siteSub">来自cppreference.com</div>
                    <!-- /tagline -->
                                        <!-- subtitle -->
                    <div id="contentSub"><span class="subpages">&lt; <a href="../../cpp.html" title="cpp">cpp</a>‎ | <a href="../header.html" title="cpp/header">header</a></span></div>
                    <!-- /subtitle -->
                                                            <!-- bodycontent -->
                    <div id="mw-content-text" lang="zh" dir="ltr" class="mw-content-ltr"><div class="t-navbar" style=""><div class="t-navbar-sep"> </div><div class="t-navbar-head"><a href="../../cpp.html" title="cpp"> C++</a><div class="t-navbar-menu"><div><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="../language.html" title="cpp/language">语言</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../header.html" title="cpp/header">标准库头文件</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../freestanding.html" title="cpp/freestanding"> 自立与有宿主实现</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../named_req.html" title="cpp/named req">具名要求</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../utility.html#.E8.AF.AD.E8.A8.80.E6.94.AF.E6.8C.81" title="cpp/utility">语言支持库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../concepts.html" title="cpp/concepts">概念库</a> <span class="t-mark-rev t-since-cxx20">(C++20)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../error.html" title="cpp/error">诊断库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../utility.html" title="cpp/utility">工具库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../string.html" title="cpp/string">字符串库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../container.html" title="cpp/container">容器库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../iterator.html" title="cpp/iterator">迭代器库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../ranges.html" title="cpp/ranges"> 范围库</a> <span class="t-mark-rev t-since-cxx20">(C++20)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../algorithm.html" title="cpp/algorithm">算法库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../numeric.html" title="cpp/numeric">数值库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../locale.html" title="cpp/locale">本地化库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../io.html" title="cpp/io">输入/输出库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../filesystem.html" title="cpp/filesystem">文件系统库</a> <span class="t-mark-rev t-since-cxx17">(C++17)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../regex.html" title="cpp/regex">正则表达式库</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../atomic.html" title="cpp/atomic">原子操作库</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../thread.html" title="cpp/thread">线程支持库</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../experimental.html" title="cpp/experimental">技术规范</a> </td></tr>
</table></div><div></div></div></div></div><div class="t-navbar-sep"> </div><div class="t-navbar-head"><a href="../header.html" title="cpp/header"> 标准库头文件</a><div class="t-navbar-menu"><div><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv-h2"><td colspan="5"> 语言支持</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="cstddef.html" title="cpp/header/cstddef"><tt>&lt;cstddef&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="cstdlib.html" title="cpp/header/cstdlib"><tt>&lt;cstdlib&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="version.html" title="cpp/header/version"><tt>&lt;version&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="limits.html" title="cpp/header/limits"><tt>&lt;limits&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="climits.html" title="cpp/header/climits"><tt>&lt;climits&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="cfloat.html" title="cpp/header/cfloat"><tt>&lt;cfloat&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="cstdint.html" title="cpp/header/cstdint"><tt>&lt;cstdint&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="new.html" title="cpp/header/new"><tt>&lt;new&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="typeinfo.html" title="cpp/header/typeinfo"><tt>&lt;typeinfo&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <br>
</td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="source_location.html" title="cpp/header/source location"><tt>&lt;source_location&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="exception.html" title="cpp/header/exception"><tt>&lt;exception&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="initializer_list.html" title="cpp/header/initializer list"><tt>&lt;initializer_list&gt;</tt></a>    </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="compare.html" title="cpp/header/compare"><tt>&lt;compare&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <br>
</td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="coroutine.html" title="cpp/header/coroutine"><tt>&lt;coroutine&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="csignal.html" title="cpp/header/csignal"><tt>&lt;csignal&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="csetjmp.html" title="cpp/header/csetjmp"><tt>&lt;csetjmp&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="cstdarg.html" title="cpp/header/cstdarg"><tt>&lt;cstdarg&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <br>
</td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 概念</td></tr>
<tr class="t-nv"><td colspan="5"> <a href="concepts.html" title="cpp/header/concepts"><tt>&lt;concepts&gt;</tt></a></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 诊断</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="stdexcept.html" title="cpp/header/stdexcept"><tt>&lt;stdexcept&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="cassert.html" title="cpp/header/cassert"><tt>&lt;cassert&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="cerrno.html" title="cpp/header/cerrno"><tt>&lt;cerrno&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="system_error.html" title="cpp/header/system error"><tt>&lt;system_error&gt;</tt></a></td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 通用工具</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="utility.html" title="cpp/header/utility"><tt>&lt;utility&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <strong class="selflink"><tt>&lt;memory&gt;</tt></strong></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="memory_resource.html" title="cpp/header/memory resource"><tt>&lt;memory_resource&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="scoped_allocator.html" title="cpp/header/scoped allocator"><tt>&lt;scoped_allocator&gt;</tt></a>    </td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="bitset.html" title="cpp/header/bitset"><tt>&lt;bitset&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="tuple.html" title="cpp/header/tuple"><tt>&lt;tuple&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="optional.html" title="cpp/header/optional"><tt>&lt;optional&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="any.html" title="cpp/header/any"><tt>&lt;any&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="variant.html" title="cpp/header/variant"><tt>&lt;variant&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="type_traits.html" title="cpp/header/type traits"><tt>&lt;type_traits&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="ratio.html" title="cpp/header/ratio"><tt>&lt;ratio&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="chrono.html" title="cpp/header/chrono"><tt>&lt;chrono&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="typeindex.html" title="cpp/header/typeindex"><tt>&lt;typeindex&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="functional.html" title="cpp/header/functional"><tt>&lt;functional&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="stacktrace.html" title="cpp/header/stacktrace"><tt>&lt;stacktrace&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="ctime.html" title="cpp/header/ctime"><tt>&lt;ctime&gt;</tt></a></td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 字符串</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="string.html" title="cpp/header/string"><tt>&lt;string&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="string_view.html" title="cpp/header/string view"><tt>&lt;string_view&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="cstring.html" title="cpp/header/cstring"><tt>&lt;cstring&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="charconv.html" title="cpp/header/charconv"><tt>&lt;charconv&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="format.html" title="cpp/header/format"><tt>&lt;format&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <br>
</td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="cctype.html" title="cpp/header/cctype"><tt>&lt;cctype&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="cwctype.html" title="cpp/header/cwctype"><tt>&lt;cwctype&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <br>
</td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="cwchar.html" title="cpp/header/cwchar"><tt>&lt;cwchar&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="cuchar.html" title="cpp/header/cuchar"><tt>&lt;cuchar&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <br>
</td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 本地化</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="locale.html" title="cpp/header/locale"><tt>&lt;locale&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="codecvt.html" title="cpp/header/codecvt"><tt>&lt;codecvt&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="clocale.html" title="cpp/header/clocale"><tt>&lt;clocale&gt;</tt></a></td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 容器</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="span.html" title="cpp/header/span"><tt>&lt;span&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="array.html" title="cpp/header/array"><tt>&lt;array&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="vector.html" title="cpp/header/vector"><tt>&lt;vector&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="deque.html" title="cpp/header/deque"><tt>&lt;deque&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="forward_list.html" title="cpp/header/forward list"><tt>&lt;forward_list&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="list.html" title="cpp/header/list"><tt>&lt;list&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="map.html" title="cpp/header/map"><tt>&lt;map&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="set.html" title="cpp/header/set"><tt>&lt;set&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="queue.html" title="cpp/header/queue"><tt>&lt;queue&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="unordered_map.html" title="cpp/header/unordered map"><tt>&lt;unordered_map&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="unordered_set.html" title="cpp/header/unordered set"><tt>&lt;unordered_set&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="stack.html" title="cpp/header/stack"><tt>&lt;stack&gt;</tt></a></td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 迭代器</td></tr>
<tr class="t-nv"><td colspan="5"> <a href="iterator.html" title="cpp/header/iterator"><tt>&lt;iterator&gt;</tt></a></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 范围</td></tr>
<tr class="t-nv"><td colspan="5"> <a href="ranges.html" title="cpp/header/ranges"><tt>&lt;ranges&gt;</tt></a></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 算法</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="algorithm.html" title="cpp/header/algorithm"><tt>&lt;algorithm&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="execution.html" title="cpp/header/execution"><tt>&lt;execution&gt;</tt></a></td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 数值</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="complex.html" title="cpp/header/complex"><tt>&lt;complex&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="random.html" title="cpp/header/random"><tt>&lt;random&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="valarray.html" title="cpp/header/valarray"><tt>&lt;valarray&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="numeric.html" title="cpp/header/numeric"><tt>&lt;numeric&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="bit.html" title="cpp/header/bit"><tt>&lt;bit&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="numbers.html" title="cpp/header/numbers"><tt>&lt;numbers&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="cfenv.html" title="cpp/header/cfenv"><tt>&lt;cfenv&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="cmath.html" title="cpp/header/cmath"><tt>&lt;cmath&gt;</tt></a></td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 输入/输出</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="iosfwd.html" title="cpp/header/iosfwd"><tt>&lt;iosfwd&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="ios.html" title="cpp/header/ios"><tt>&lt;ios&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="iomanip.html" title="cpp/header/iomanip"><tt>&lt;iomanip&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="streambuf.html" title="cpp/header/streambuf"><tt>&lt;streambuf&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="istream.html" title="cpp/header/istream"><tt>&lt;istream&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="ostream.html" title="cpp/header/ostream"><tt>&lt;ostream&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="iostream.html" title="cpp/header/iostream"><tt>&lt;iostream&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <br>
</td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="sstream.html" title="cpp/header/sstream"><tt>&lt;sstream&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="spanstream.html" title="cpp/header/spanstream"><tt>&lt;spanstream&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="fstream.html" title="cpp/header/fstream"><tt>&lt;fstream&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="syncstream.html" title="cpp/header/syncstream"><tt>&lt;syncstream&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="cstdio.html" title="cpp/header/cstdio"><tt>&lt;cstdio&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="cinttypes.html" title="cpp/header/cinttypes"><tt>&lt;cinttypes&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="strstream.html" title="cpp/header/strstream"><tt>&lt;strstream&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <br>
</td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 正则表达式</td></tr>
<tr class="t-nv"><td colspan="5"> <a href="regex.html" title="cpp/header/regex"><tt>&lt;regex&gt;</tt></a></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 文件系统</td></tr>
<tr class="t-nv"><td colspan="5"> <a href="filesystem.html" title="cpp/header/filesystem"><tt>&lt;filesystem&gt;</tt></a></td></tr>
<tr class="t-nv-h2"><td colspan="5"> 线程支持</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="thread.html" title="cpp/header/thread"><tt>&lt;thread&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="atomic.html" title="cpp/header/atomic"><tt>&lt;atomic&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="mutex.html" title="cpp/header/mutex"><tt>&lt;mutex&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="shared_mutex.html" title="cpp/header/shared mutex"><tt>&lt;shared_mutex&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="condition_variable.html" title="cpp/header/condition variable"><tt>&lt;condition_variable&gt;</tt></a>    </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="future.html" title="cpp/header/future"><tt>&lt;future&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="stop_token.html" title="cpp/header/stop token"><tt>&lt;stop_token&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="semaphore.html" title="cpp/header/semaphore"><tt>&lt;semaphore&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <br>
</td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="latch.html" title="cpp/header/latch"><tt>&lt;latch&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="barrier.html" title="cpp/header/barrier"><tt>&lt;barrier&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <br>
</td></tr>
</table></div></td></tr>
<tr class="t-nv-h2"><td colspan="5"> C 兼容</td></tr>
<tr class="t-nv-col-table"><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="ciso646.html" title="cpp/header/ciso646"><tt>&lt;ciso646&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="cstdalign.html" title="cpp/header/cstdalign"><tt>&lt;cstdalign&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="cstdbool.html" title="cpp/header/cstdbool"><tt>&lt;cstdbool&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="ccomplex.html" title="cpp/header/ccomplex"><tt>&lt;ccomplex&gt;</tt></a></td></tr>
</table></div></td><td><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em">
<tr class="t-nv"><td colspan="5"> <a href="ctgmath.html" title="cpp/header/ctgmath"><tt>&lt;ctgmath&gt;</tt></a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="stdatomic.h.html" title="cpp/header/stdatomic.h"><tt>&lt;stdatomic.h&gt;</tt></a></td></tr>
</table></div></td></tr>
</table></div><div></div></div></div></div><div class="t-navbar-sep"> </div></div>
<p>此头文件是<a href="../memory.html" title="cpp/memory">动态内存管理</a>库的一部分。
</p>
<table class="t-dsc-begin">

<tr>
<td colspan="2"> <h3> <span class="mw-headline" id=".E5.8C.85.E5.90.AB"> 包含</span></h3>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="compare.html" title="cpp/header/compare"> <span class="t-lines"><span>&lt;compare&gt;</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  <a href="../language/operator_comparison.html#.E4.B8.89.E8.B7.AF.E6.AF.94.E8.BE.83" title="cpp/language/operator comparison">三路比较运算符</a>支持 </td></tr>


<tr>
<td colspan="2"> <h3> <span class="mw-headline" id=".E7.B1.BB"> 类</span></h3>
</td></tr>

<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E6.8C.87.E9.92.88.E7.89.B9.E5.BE.81">  指针特征 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/pointer_traits.html" title="cpp/memory/pointer traits"> <span class="t-lines"><span>pointer_traits</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   提供关于指针式类型的信息 <br> <span class="t-mark">(类模板)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E5.9E.83.E5.9C.BE.E6.94.B6.E9.9B.86.E5.99.A8.E6.94.AF.E6.8C.81">  垃圾收集器支持 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/gc/pointer_safety.html" title="cpp/memory/gc/pointer safety"> <span class="t-lines"><span>pointer_safety</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span><span class="t-mark-rev t-until-cxx23">(C++23 中移除)</span></span></span></div></div>
</td>
<td>  列出指针安全模式 <br> <span class="t-mark">(枚举)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E5.88.86.E9.85.8D.E5.99.A8">  分配器 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/allocator.html" title="cpp/memory/allocator"> <span class="t-lines"><span>allocator</span></span></a></div></div>
</td>
<td>   默认的分配器  <br> <span class="t-mark">(类模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/allocator_traits.html" title="cpp/memory/allocator traits"> <span class="t-lines"><span>allocator_traits</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   提供关于分配器类型的信息  <br> <span class="t-mark">(类模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/allocation_result.html" title="cpp/memory/allocation result"> <span class="t-lines"><span>allocation_result</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx23">(C++23)</span></span></span></div></div>
</td>
<td>   记录由 <code>allocate_at_least</code> 分配的存储的地址与实际大小 <br> <span class="t-mark">(类模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/allocator_arg_t.html" title="cpp/memory/allocator arg t"> <span class="t-lines"><span>allocator_arg_t</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   标签类型，用于选择具分配器的构造函数重载 <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/uses_allocator.html" title="cpp/memory/uses allocator"> <span class="t-lines"><span>uses_allocator</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   检查指定的类型是否支持使用分配器的构造  <br> <span class="t-mark">(类模板)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E6.9C.AA.E5.88.9D.E5.A7.8B.E5.8C.96.E5.AD.98.E5.82.A8">  未初始化存储 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/raw_storage_iterator.html" title="cpp/memory/raw storage iterator"> <span class="t-lines"><span>raw_storage_iterator</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-deprecated-cxx17">(C++17 中弃用)</span></span><span><span class="t-mark-rev t-until-cxx20">(C++20 中移除)</span></span></span></div></div>
</td>
<td>  允许标准算法存储结果于未初始化内存的迭代器 <br> <span class="t-mark">(类模板)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E6.99.BA.E8.83.BD.E6.8C.87.E9.92.88">  智能指针 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/unique_ptr.html" title="cpp/memory/unique ptr"> <span class="t-lines"><span>unique_ptr</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>  拥有独有对象所有权语义的智能指针  <br> <span class="t-mark">(类模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/shared_ptr.html" title="cpp/memory/shared ptr"> <span class="t-lines"><span>shared_ptr</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   拥有共享对象所有权语义的智能指针  <br> <span class="t-mark">(类模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/weak_ptr.html" title="cpp/memory/weak ptr"> <span class="t-lines"><span>weak_ptr</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   到 <span class="t-lc"><a href="../memory/shared_ptr.html" title="cpp/memory/shared ptr">std::shared_ptr</a></span> 所管理对象的弱引用  <br> <span class="t-mark">(类模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/auto_ptr.html" title="cpp/memory/auto ptr"> <span class="t-lines"><span>auto_ptr</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-until-cxx17">(C++17 中移除)</span></span></span></div></div>
</td>
<td>  拥有严格对象所有权语义的智能指针 <br> <span class="t-mark">(类模板)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E8.BE.85.E5.8A.A9.E7.B1.BB">  辅助类 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/shared_ptr/atomic2.html" title="cpp/memory/shared ptr/atomic2"> <span class="t-lines"><span>std::atomic<span class="t-dsc-small">&lt;std::shared_ptr&gt;</span></span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  原子共享指针 <br> <span class="t-mark">(类模板特化)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/weak_ptr/atomic2.html" title="cpp/memory/weak ptr/atomic2"> <span class="t-lines"><span>std::atomic<span class="t-dsc-small">&lt;std::weak_ptr&gt;</span></span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  原子弱指针 <br> <span class="t-mark">(类模板特化)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/owner_less.html" title="cpp/memory/owner less"> <span class="t-lines"><span>owner_less</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   提供基于所有者的，共享指针和弱指针的混合类型的排序 <br> <span class="t-mark">(类模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/enable_shared_from_this.html" title="cpp/memory/enable shared from this"> <span class="t-lines"><span>enable_shared_from_this</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   允许对象创建指代自身的 <code>shared_ptr</code> <br> <span class="t-mark">(类模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/bad_weak_ptr.html" title="cpp/memory/bad weak ptr"> <span class="t-lines"><span>bad_weak_ptr</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   访问指向已销毁对象的 <code>weak_ptr</code> 时抛出的异常  <br> <span class="t-mark">(类)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/default_delete.html" title="cpp/memory/default delete"> <span class="t-lines"><span>default_delete</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   <code>unique_ptr</code> 的默认删除器  <br> <span class="t-mark">(类模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/unique_ptr/hash.html" title="cpp/memory/unique ptr/hash"> <span class="t-lines"><span>std::hash<span class="t-dsc-small">&lt;std::unique_ptr&gt;</span></span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>  <span class="t-lc"><a href="../memory/unique_ptr.html" title="cpp/memory/unique ptr">std::unique_ptr</a></span> 的散列支持  <br> <span class="t-mark">(类模板特化)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/shared_ptr/hash.html" title="cpp/memory/shared ptr/hash"> <span class="t-lines"><span>std::hash<span class="t-dsc-small">&lt;std::shared_ptr&gt;</span></span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>  <span class="t-lc"><a href="../memory/shared_ptr.html" title="cpp/memory/shared ptr">std::shared_ptr</a></span> 的散列支持 <br> <span class="t-mark">(类模板特化)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E6.99.BA.E8.83.BD.E6.8C.87.E9.92.88.E9.80.82.E9.85.8D.E5.99.A8">  智能指针适配器 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/out_ptr_t.html" title="cpp/memory/out ptr t"> <span class="t-lines"><span>out_ptr_t</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx23">(C++23)</span></span></span></div></div>
</td>
<td>   与外来指针设置器交互，并在析构时重设智能指针 <br> <span class="t-mark">(类模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/inout_ptr_t.html" title="cpp/memory/inout ptr t"> <span class="t-lines"><span>inout_ptr_t</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx23">(C++23)</span></span></span></div></div>
</td>
<td>   与外来指针设置器交互，从智能指针获得初始指针值，并在析构时重设它 <br> <span class="t-mark">(类模板)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E5.89.8D.E7.BD.AE.E5.A3.B0.E6.98.8E">  前置声明 </span></h5>
</td></tr>

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于头文件 <code><a href="functional.html" title="cpp/header/functional">&lt;functional&gt;</a></code> </div>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../utility/hash.html" title="cpp/utility/hash"> <span class="t-lines"><span>hash</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>  散列函数对象 <br> <span class="t-mark">(类模板)</span> </td></tr>

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于头文件 <code><a href="atomic.html" title="cpp/header/atomic">&lt;atomic&gt;</a></code> </div>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../atomic/atomic.html" title="cpp/atomic/atomic"> <span class="t-lines"><span>atomic</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   atomic 类模板及其针对布尔、整型和指针类型的特化  <br> <span class="t-mark">(类模板)</span> </td></tr>


<tr>
<td colspan="2"> <h3> <span class="mw-headline" id=".E5.B8.B8.E9.87.8F"> 常量</span></h3>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/allocator_arg.html" title="cpp/memory/allocator arg"> <span class="t-lines"><span>allocator_arg</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   用于选择具分配器的构造函数的 <span class="t-lc"><a href="../memory/allocator_arg_t.html" title="cpp/memory/allocator arg t">std::allocator_arg_t</a></span> 对象 <br> <span class="t-mark">(常量)</span> </td></tr>


<tr>
<td colspan="2"> <h3> <span class="mw-headline" id=".E5.87.BD.E6.95.B0"> 函数</span></h3>
</td></tr>

<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E5.88.86.E9.85.8D.E5.99.A8_2">  分配器 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/allocate_at_least.html" title="cpp/memory/allocate at least"> <span class="t-lines"><span>allocate_at_least</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx23">(C++23)</span></span></span></div></div>
</td>
<td>   经由分配器分配至少与请求的大小一样大的存储 <br> <span class="t-mark">(函数模板)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E6.9D.82.E9.A1.B9">  杂项 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/to_address.html" title="cpp/memory/to address"> <span class="t-lines"><span>to_address</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  从指针式类型获得裸指针 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/addressof.html" title="cpp/memory/addressof"> <span class="t-lines"><span>addressof</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   获得对象的实际地址，即使其重载了 <i>&amp;</i> 运算符  <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/align.html" title="cpp/memory/align"> <span class="t-lines"><span>align</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   对齐缓冲区中的指针  <br> <span class="t-mark">(函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/assume_aligned.html" title="cpp/memory/assume aligned"> <span class="t-lines"><span>assume_aligned</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  告知编译器指针已对齐 <br> <span class="t-mark">(函数模板)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E5.9E.83.E5.9C.BE.E6.94.B6.E9.9B.86.E5.99.A8.E6.94.AF.E6.8C.81_2">  垃圾收集器支持 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/gc/declare_reachable.html" title="cpp/memory/gc/declare reachable"> <span class="t-lines"><span>declare_reachable</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span><span class="t-mark-rev t-until-cxx23">(C++23 中移除)</span></span></span></div></div>
</td>
<td>   声明一个对象不能被回收  <br> <span class="t-mark">(函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/gc/undeclare_reachable.html" title="cpp/memory/gc/undeclare reachable"> <span class="t-lines"><span>undeclare_reachable</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span><span class="t-mark-rev t-until-cxx23">(C++23 中移除)</span></span></span></div></div>
</td>
<td>   声明一个对象可以被回收  <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/gc/declare_no_pointers.html" title="cpp/memory/gc/declare no pointers"> <span class="t-lines"><span>declare_no_pointers</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span><span class="t-mark-rev t-until-cxx23">(C++23 中移除)</span></span></span></div></div>
</td>
<td>  声明该内存区域不含可追踪指针 <br> <span class="t-mark">(函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/gc/undeclare_no_pointers.html" title="cpp/memory/gc/undeclare no pointers"> <span class="t-lines"><span>undeclare_no_pointers</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span><span class="t-mark-rev t-until-cxx23">(C++23 中移除)</span></span></span></div></div>
</td>
<td>  取消 <span class="t-lc"><a href="../memory/gc/declare_no_pointers.html" title="cpp/memory/gc/declare no pointers">std::declare_no_pointers</a></span> 的效果 <br> <span class="t-mark">(函数)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/gc/get_pointer_safety.html" title="cpp/memory/gc/get pointer safety"> <span class="t-lines"><span>get_pointer_safety</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span><span class="t-mark-rev t-until-cxx23">(C++23 中移除)</span></span></span></div></div>
</td>
<td>   返回当前的指针安全模式  <br> <span class="t-mark">(函数)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E6.9C.AA.E5.88.9D.E5.A7.8B.E5.8C.96.E5.AD.98.E5.82.A8_2">  未初始化存储 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/uninitialized_copy.html" title="cpp/memory/uninitialized copy"> <span class="t-lines"><span>uninitialized_copy</span></span></a></div></div>
</td>
<td>   将范围内的对象复制到未初始化的内存区域  <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/uninitialized_copy_n.html" title="cpp/memory/uninitialized copy n"> <span class="t-lines"><span>uninitialized_copy_n</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   将指定数量的对象复制到未初始化的内存区域  <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/uninitialized_fill.html" title="cpp/memory/uninitialized fill"> <span class="t-lines"><span>uninitialized_fill</span></span></a></div></div>
</td>
<td>  复制一个对象到以范围定义的未初始化内存区域 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/uninitialized_fill_n.html" title="cpp/memory/uninitialized fill n"> <span class="t-lines"><span>uninitialized_fill_n</span></span></a></div></div>
</td>
<td>  复制一个对象到以起点和计数定义的未初始化内存区域 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/uninitialized_move.html" title="cpp/memory/uninitialized move"> <span class="t-lines"><span>uninitialized_move</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div>
</td>
<td>   移动一个范围的对象到未初始化的内存区域  <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/uninitialized_move_n.html" title="cpp/memory/uninitialized move n"> <span class="t-lines"><span>uninitialized_move_n</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div>
</td>
<td>   移动一定数量对象到未初始化内存区域 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/uninitialized_default_construct.html" title="cpp/memory/uninitialized default construct"> <span class="t-lines"><span>uninitialized_default_construct</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div>
</td>
<td>   在范围所定义的未初始化的内存区域以<a href="../language/default_initialization.html" title="cpp/language/default initialization">默认初始化</a>构造对象 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/uninitialized_default_construct_n.html" title="cpp/memory/uninitialized default construct n"> <span class="t-lines"><span>uninitialized_default_construct_n</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div>
</td>
<td>   在起始和计数所定义的未初始化内存区域用<a href="../language/default_initialization.html" title="cpp/language/default initialization">默认初始化</a>构造对象 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/uninitialized_value_construct.html" title="cpp/memory/uninitialized value construct"> <span class="t-lines"><span>uninitialized_value_construct</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div>
</td>
<td>   在范围所定义的未初始化内存中用<a href="../language/value_initialization.html" title="cpp/language/value initialization">值初始化</a>构造对象 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/uninitialized_value_construct_n.html" title="cpp/memory/uninitialized value construct n"> <span class="t-lines"><span>uninitialized_value_construct_n</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div>
</td>
<td>   在起始和计数所定义的未初始化内存区域以<a href="../language/value_initialization.html" title="cpp/language/value initialization">值初始化</a>构造对象 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/construct_at.html" title="cpp/memory/construct at"> <span class="t-lines"><span>construct_at</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>   在给定地址创建对象  <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/destroy_at.html" title="cpp/memory/destroy at"> <span class="t-lines"><span>destroy_at</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div>
</td>
<td>   销毁在给定地址的对象  <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/destroy.html" title="cpp/memory/destroy"> <span class="t-lines"><span>destroy</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div>
</td>
<td>   销毁一个范围中的对象  <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/destroy_n.html" title="cpp/memory/destroy n"> <span class="t-lines"><span>destroy_n</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div>
</td>
<td>   销毁范围中一定数量的对象  <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/get_temporary_buffer.html" title="cpp/memory/get temporary buffer"> <span class="t-lines"><span>get_temporary_buffer</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-deprecated-cxx17">(C++17 中弃用)</span></span><span><span class="t-mark-rev t-until-cxx20">(C++20 中移除)</span></span></span></div></div>
</td>
<td>  获得未初始化存储 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/return_temporary_buffer.html" title="cpp/memory/return temporary buffer"> <span class="t-lines"><span>return_temporary_buffer</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-deprecated-cxx17">(C++17 中弃用)</span></span><span><span class="t-mark-rev t-until-cxx20">(C++20 中移除)</span></span></span></div></div>
</td>
<td>  释放未初始化存储 <br> <span class="t-mark">(函数模板)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E6.99.BA.E8.83.BD.E6.8C.87.E9.92.88.E9.9D.9E.E6.88.90.E5.91.98.E6.93.8D.E4.BD.9C">  智能指针非成员操作 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/unique_ptr/make_unique.html" title="cpp/memory/unique ptr/make unique"> <span class="t-lines"><span>make_unique</span><span>make_unique_for_overwrite</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx14">(C++14)</span></span><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  创建管理一个新对象的独占指针 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/unique_ptr/operator_cmp.html" title="cpp/memory/unique ptr/operator cmp"> <span class="t-lines"><span>operator==</span><span>operator!=</span><span>operator&lt;</span><span>operator&lt;=</span><span>operator&gt;</span><span>operator&gt;=</span><span>operator&lt;=&gt;</span></span></a></div><div><span class="t-lines"><span></span><span><span class="t-mark-rev t-until-cxx20">(C++20 中移除)</span></span><span></span><span></span><span></span><span></span><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>   与另一个 <code>unique_ptr</code> 或 <span class="t-c"><span class="mw-geshi cpp source-cpp">nullptr</span></span> 进行比较  <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/shared_ptr/make_shared.html" title="cpp/memory/shared ptr/make shared"> <span class="t-lines"><span>make_shared</span><span>make_shared_for_overwrite</span></span></a></div><div><span class="t-lines"><span></span><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  创建管理一个新对象的共享指针 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/shared_ptr/allocate_shared.html" title="cpp/memory/shared ptr/allocate shared"> <span class="t-lines"><span>allocate_shared</span><span>allocate_shared_for_overwrite</span></span></a></div><div><span class="t-lines"><span></span><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  创建管理一个用分配器分配的新对象的共享指针 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/shared_ptr/pointer_cast.html" title="cpp/memory/shared ptr/pointer cast"> <span class="t-lines"><span>static_pointer_cast</span><span>dynamic_pointer_cast</span><span>const_pointer_cast</span><span>reinterpret_pointer_cast</span></span></a></div><div><span class="t-lines"><span></span><span></span><span></span><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div></div>
</td>
<td>  应用 <a href="../language/static_cast.html" title="cpp/language/static cast"><tt>static_cast</tt></a>、<a href="../language/dynamic_cast.html" title="cpp/language/dynamic cast"><tt>dynamic_cast</tt></a>、<a href="../language/const_cast.html" title="cpp/language/const cast"><tt>const_cast</tt></a> 或 <a href="../language/reinterpret_cast.html" title="cpp/language/reinterpret cast"><tt>reinterpret_cast</tt></a> 到被存储指针 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/shared_ptr/get_deleter.html" title="cpp/memory/shared ptr/get deleter"> <span class="t-lines"><span>get_deleter</span></span></a></div></div>
</td>
<td>   返回指定类型中的删除器，若其拥有  <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/shared_ptr/operator_cmp.html" title="cpp/memory/shared ptr/operator cmp"> <span class="t-lines"><span>operator==</span><span>operator!=</span><span>operator&lt;</span><span>operator&lt;=</span><span>operator&gt;</span><span>operator&gt;=</span><span>operator&lt;=&gt;</span></span></a></div><div><span class="t-lines"><span></span><span><span class="t-mark-rev t-until-cxx20">(C++20 中移除)</span></span><span><span class="t-mark-rev t-until-cxx20">(C++20 中移除)</span></span><span><span class="t-mark-rev t-until-cxx20">(C++20 中移除)</span></span><span><span class="t-mark-rev t-until-cxx20">(C++20 中移除)</span></span><span><span class="t-mark-rev t-until-cxx20">(C++20 中移除)</span></span><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>   与另一个 <code>shared_ptr</code> 或 <span class="t-c"><span class="mw-geshi cpp source-cpp">nullptr</span></span> 进行比较  <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/shared_ptr/operator_ltlt.html" title="cpp/memory/shared ptr/operator ltlt"> <span class="t-lines"><span>operator&lt;&lt;</span></span></a></div></div>
</td>
<td>  将存储的指针的值输出到输出流 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/unique_ptr/swap2.html" title="cpp/memory/unique ptr/swap2"> <span class="t-lines"><span>std::swap<span class="t-dsc-small">(std::unique_ptr)</span></span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   特化 <span class="t-lc"><a href="../algorithm/swap.html" title="cpp/algorithm/swap">std::swap</a></span> 算法  <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/weak_ptr/swap2.html" title="cpp/memory/weak ptr/swap2"> <span class="t-lines"><span>std::swap<span class="t-dsc-small">(std::weak_ptr)</span></span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   特化 <span class="t-lc"><a href="../algorithm/swap.html" title="cpp/algorithm/swap">std::swap</a></span> 算法 <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/shared_ptr/swap2.html" title="cpp/memory/shared ptr/swap2"> <span class="t-lines"><span>std::swap<span class="t-dsc-small">(std::shared_ptr)</span></span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div></div>
</td>
<td>   特化 <span class="t-lc"><a href="../algorithm/swap.html" title="cpp/algorithm/swap">std::swap</a></span> 算法  <br> <span class="t-mark">(函数模板)</span> </td></tr>


<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E6.99.BA.E8.83.BD.E6.8C.87.E9.92.88.E9.80.82.E9.85.8D.E5.99.A8.E5.88.9B.E5.BB.BA">  智能指针适配器创建 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/out_ptr_t/out_ptr.html" title="cpp/memory/out ptr t/out ptr"> <span class="t-lines"><span>out_ptr</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx23">(C++23)</span></span></span></div></div>
</td>
<td>   以关联的智能指针和重设参数创建 <code>out_ptr_t</code> <br> <span class="t-mark">(函数模板)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/inout_ptr_t/inout_ptr.html" title="cpp/memory/inout ptr t/inout ptr"> <span class="t-lines"><span>inout_ptr</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx23">(C++23)</span></span></span></div></div>
</td>
<td>   以关联的智能指针和重设参数创建 <code>inout_ptr_t</code> <br> <span class="t-mark">(函数模板)</span> </td></tr>

</table>
<table class="t-dsc-begin">


<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/shared_ptr/atomic.html" title="cpp/memory/shared ptr/atomic"> <span class="t-lines"><span>std::atomic_is_lock_free<span class="t-dsc-small">(std::shared_ptr)</span></span><span>std::atomic_load<span class="t-dsc-small">(std::shared_ptr)</span></span><span>std::atomic_load_explicit<span class="t-dsc-small">(std::shared_ptr)</span></span><span>std::atomic_store<span class="t-dsc-small">(std::shared_ptr)</span></span><span>std::atomic_store_explicit<span class="t-dsc-small">(std::shared_ptr)</span></span><span>std::atomic_exchange<span class="t-dsc-small">(std::shared_ptr)</span></span><span>std::atomic_exchange_explicit<span class="t-dsc-small">(std::shared_ptr)</span></span><span>std::atomic_compare_exchange_weak<span class="t-dsc-small">(std::shared_ptr)</span></span><span>std::atomic_compare_exchange_strong<span class="t-dsc-small">(std::shared_ptr)</span></span><span>std::atomic_compare_exchange_weak_explicit<span class="t-dsc-small">(std::shared_ptr)</span></span><span>std::atomic_compare_exchange_strong_explicit<span class="t-dsc-small">(std::shared_ptr)</span></span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-deprecated-cxx20">(C++20 中弃用)</span></span></span></div></div>
</td>
<td>   特化的原子操作  <br> <span class="t-mark">(函数模板)</span> </td></tr>
</table>
<table class="t-dsc-begin">



<tr>
<td colspan="2"> <h3> <span class="mw-headline" id=".E4.BB.BF.E5.87.BD.E6.95.B0.E5.AE.9E.E4.BD.93"> 仿函数实体</span></h3>
</td></tr>

<tr class="t-dsc-header">
<td colspan="2"> <div>定义于命名空间 <code>std::ranges</code></div>
</td></tr>

<tr>
<td colspan="2"> <h5> <span class="mw-headline" id=".E6.9C.AA.E5.88.9D.E5.A7.8B.E5.8C.96.E5.AD.98.E5.82.A8_3">  未初始化存储 </span></h5>
</td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/ranges/uninitialized_copy.html" title="cpp/memory/ranges/uninitialized copy"> <span class="t-lines"><span>ranges::uninitialized_copy</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  复制元素范围到未初始化的内存区域 <br> <span class="t-mark">(niebloid)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/ranges/uninitialized_copy_n.html" title="cpp/memory/ranges/uninitialized copy n"> <span class="t-lines"><span>ranges::uninitialized_copy_n</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  复制一定量元素到未初始化的内存区域 <br> <span class="t-mark">(niebloid)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/ranges/uninitialized_fill.html" title="cpp/memory/ranges/uninitialized fill"> <span class="t-lines"><span>ranges::uninitialized_fill</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  复制一个对象到范围所定义的未初始化的内存区域 <br> <span class="t-mark">(niebloid)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/ranges/uninitialized_fill_n.html" title="cpp/memory/ranges/uninitialized fill n"> <span class="t-lines"><span>ranges::uninitialized_fill_n</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  复制一个对象到起始与计数所定义的未初始化的内存区域 <br> <span class="t-mark">(niebloid)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/ranges/uninitialized_move.html" title="cpp/memory/ranges/uninitialized move"> <span class="t-lines"><span>ranges::uninitialized_move</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  移动对象范围到未初始化的内存区域 <br> <span class="t-mark">(niebloid)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/ranges/uninitialized_move_n.html" title="cpp/memory/ranges/uninitialized move n"> <span class="t-lines"><span>ranges::uninitialized_move_n</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  移动一定量对象到未初始化的内存区域 <br> <span class="t-mark">(niebloid)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/ranges/uninitialized_default_construct.html" title="cpp/memory/ranges/uninitialized default construct"> <span class="t-lines"><span>ranges::uninitialized_default_construct</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  在范围所定义的未初始化的内存区域以<a href="../language/default_initialization.html" title="cpp/language/default initialization">默认初始化</a>构造对象 <br> <span class="t-mark">(niebloid)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/ranges/uninitialized_default_construct_n.html" title="cpp/memory/ranges/uninitialized default construct n"> <span class="t-lines"><span>ranges::uninitialized_default_construct_n</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  在起始与计数所定义的未初始化的内存区域以<a href="../language/default_initialization.html" title="cpp/language/default initialization">默认初始化</a>构造对象 <br> <span class="t-mark">(niebloid)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/ranges/uninitialized_value_construct.html" title="cpp/memory/ranges/uninitialized value construct"> <span class="t-lines"><span>ranges::uninitialized_value_construct</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  在范围所定义的未初始化的内存区域以<a href="../language/value_initialization.html" title="cpp/language/value initialization">值初始化</a>构造对象 <br> <span class="t-mark">(niebloid)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/ranges/uninitialized_value_construct_n.html" title="cpp/memory/ranges/uninitialized value construct n"> <span class="t-lines"><span>ranges::uninitialized_value_construct_n</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  在起始与计数所定义的未初始化的内存区域以<a href="../language/value_initialization.html" title="cpp/language/value initialization">值初始化</a>构造对象 <br> <span class="t-mark">(niebloid)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/ranges/construct_at.html" title="cpp/memory/ranges/construct at"> <span class="t-lines"><span>ranges::construct_at</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>   在给定地址创建对象  <br> <span class="t-mark">(niebloid)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/ranges/destroy_at.html" title="cpp/memory/ranges/destroy at"> <span class="t-lines"><span>ranges::destroy_at</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  销毁位于给定地址的元素 <br> <span class="t-mark">(niebloid)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/ranges/destroy.html" title="cpp/memory/ranges/destroy"> <span class="t-lines"><span>ranges::destroy</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  销毁范围中的元素 <br> <span class="t-mark">(niebloid)</span> </td></tr>

<tr class="t-dsc">
<td>  <div class="t-dsc-member-div"><div><a href="../memory/ranges/destroy_n.html" title="cpp/memory/ranges/destroy n"> <span class="t-lines"><span>ranges::destroy_n</span></span></a></div><div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx20">(C++20)</span></span></span></div></div>
</td>
<td>  销毁范围中一定量的元素 <br> <span class="t-mark">(niebloid)</span> </td></tr>
</table>
<h3><span class="mw-headline" id=".E6.A6.82.E8.A6.81">概要</span></h3>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="co2">#include &lt;compare&gt;</span>
 
<span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="co1">// 指针特征</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Ptr<span class="sy1">&gt;</span> <span class="kw1">struct</span> pointer_traits<span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> pointer_traits<span class="sy1">&lt;</span>T<span class="sy2">*</span><span class="sy1">&gt;</span><span class="sy4">;</span>
 
  <span class="co1">// 指针转换</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> T<span class="sy2">*</span> to_address<span class="br0">(</span>T<span class="sy2">*</span> p<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Ptr<span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> <span class="kw4">auto</span> to_address<span class="br0">(</span><span class="kw4">const</span> Ptr<span class="sy3">&amp;</span> p<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
  <span class="co1">// 指针对齐</span>
  <span class="kw4">void</span><span class="sy2">*</span> align<span class="br0">(</span>size_t alignment, size_t size, <span class="kw4">void</span><span class="sy2">*</span><span class="sy3">&amp;</span> ptr, size_t<span class="sy3">&amp;</span> space<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span>size_t N, <span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="br0">[</span><span class="br0">[</span>nodiscard<span class="br0">]</span><span class="br0">]</span> <span class="kw4">constexpr</span> T<span class="sy2">*</span> assume_aligned<span class="br0">(</span>T<span class="sy2">*</span> ptr<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="co1">// 分配器参数标签</span>
  <span class="kw1">struct</span> allocator_arg_t <span class="br0">{</span> <span class="kw1">explicit</span> allocator_arg_t<span class="br0">(</span><span class="br0">)</span> <span class="sy1">=</span> <span class="kw1">default</span><span class="sy4">;</span> <span class="br0">}</span><span class="sy4">;</span>
  <span class="kw1">inline</span> <span class="kw4">constexpr</span> allocator_arg_t allocator_arg<span class="br0">{</span><span class="br0">}</span><span class="sy4">;</span>
 
  <span class="co1">// uses_­allocator</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> Alloc<span class="sy1">&gt;</span> <span class="kw1">struct</span> uses_allocator<span class="sy4">;</span>
 
  <span class="co1">// uses_­allocator</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> Alloc<span class="sy1">&gt;</span>
    <span class="kw1">inline</span> <span class="kw4">constexpr</span> <span class="kw4">bool</span> uses_allocator_v <span class="sy1">=</span> uses_allocator<span class="sy1">&lt;</span>T, Alloc<span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">value</span><span class="sy4">;</span>
 
  <span class="co1">// 使用分配器构造</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> Alloc, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> <span class="kw4">auto</span> uses_allocator_construction_args<span class="br0">(</span><span class="kw4">const</span> Alloc<span class="sy3">&amp;</span> alloc,
                                                    Args<span class="sy3">&amp;&amp;</span>... <span class="me1">args</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> Alloc, <span class="kw1">class</span> Tuple1, <span class="kw1">class</span> Tuple2<span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> <span class="kw4">auto</span> uses_allocator_construction_args<span class="br0">(</span><span class="kw4">const</span> Alloc<span class="sy3">&amp;</span> alloc, piecewise_construct_t,
                                                    Tuple1<span class="sy3">&amp;&amp;</span> x, Tuple2<span class="sy3">&amp;&amp;</span> y<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> Alloc<span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> <span class="kw4">auto</span> uses_allocator_construction_args<span class="br0">(</span><span class="kw4">const</span> Alloc<span class="sy3">&amp;</span> alloc<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> Alloc, <span class="kw1">class</span> U, <span class="kw1">class</span> V<span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> <span class="kw4">auto</span> uses_allocator_construction_args<span class="br0">(</span><span class="kw4">const</span> Alloc<span class="sy3">&amp;</span> alloc,
                                                    U<span class="sy3">&amp;&amp;</span> u, V<span class="sy3">&amp;&amp;</span> v<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> Alloc, <span class="kw1">class</span> U, <span class="kw1">class</span> V<span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> <span class="kw4">auto</span> uses_allocator_construction_args<span class="br0">(</span><span class="kw4">const</span> Alloc<span class="sy3">&amp;</span> alloc,
                                                    <span class="kw4">const</span> pair<span class="sy1">&lt;</span>U, V<span class="sy1">&gt;</span><span class="sy3">&amp;</span> pr<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> Alloc, <span class="kw1">class</span> U, <span class="kw1">class</span> V<span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> <span class="kw4">auto</span> uses_allocator_construction_args<span class="br0">(</span><span class="kw4">const</span> Alloc<span class="sy3">&amp;</span> alloc,
                                                    pair<span class="sy1">&lt;</span>U, V<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> pr<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> Alloc, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> T make_obj_using_allocator<span class="br0">(</span><span class="kw4">const</span> Alloc<span class="sy3">&amp;</span> alloc, Args<span class="sy3">&amp;&amp;</span>... <span class="me1">args</span><span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> Alloc, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> T<span class="sy2">*</span> uninitialized_construct_using_allocator<span class="br0">(</span>T<span class="sy2">*</span> p, <span class="kw4">const</span> Alloc<span class="sy3">&amp;</span> alloc,
                                                         Args<span class="sy3">&amp;&amp;</span>... <span class="me1">args</span><span class="br0">)</span><span class="sy4">;</span>
 
  <span class="co1">// 分配器特征</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Alloc<span class="sy1">&gt;</span> <span class="kw1">struct</span> allocator_traits<span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Pointer<span class="sy1">&gt;</span>
  <span class="kw1">struct</span> allocation_result <span class="br0">{</span>
    Pointer ptr<span class="sy4">;</span>
    size_t count<span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Allocator<span class="sy1">&gt;</span>
    <span class="br0">[</span><span class="br0">[</span>nodiscard<span class="br0">]</span><span class="br0">]</span> <span class="kw4">constexpr</span> allocation_result<span class="sy1">&lt;</span><span class="kw1">typename</span> allocator_traits<span class="sy1">&lt;</span>Allocator<span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">pointer</span><span class="sy1">&gt;</span>
      allocate_at_least<span class="br0">(</span>Allocator<span class="sy3">&amp;</span> a, size_t n<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="co1">// 默认分配器</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">class</span> allocator<span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> <span class="kw4">bool</span> operator<span class="sy1">==</span><span class="br0">(</span><span class="kw4">const</span> allocator<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span>, <span class="kw4">const</span> allocator<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
  <span class="co1">// addressof</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> T<span class="sy2">*</span> addressof<span class="br0">(</span>T<span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">const</span> T<span class="sy2">*</span> addressof<span class="br0">(</span><span class="kw4">const</span> T<span class="sy3">&amp;&amp;</span><span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span>
 
  <span class="co1">// 特化的算法</span>
  <span class="co1">// 特殊内存概念</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> I<span class="sy1">&gt;</span>
    concept no<span class="sy2">-</span>throw<span class="sy2">-</span>input<span class="sy2">-</span>iterator <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>    <span class="co1">// 仅用于阐释</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> I<span class="sy1">&gt;</span>
    concept no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>iterator <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>  <span class="co1">// 仅用于阐释</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> S, <span class="kw1">class</span> I<span class="sy1">&gt;</span>
    concept no<span class="sy2">-</span>throw<span class="sy2">-</span>sentinel<span class="sy2">-</span><span class="kw1">for</span> <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>      <span class="co1">// 仅用于阐释</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> R<span class="sy1">&gt;</span>
    concept no<span class="sy2">-</span>throw<span class="sy2">-</span>input<span class="sy2">-</span>range <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>       <span class="co1">// 仅用于阐释</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> R<span class="sy1">&gt;</span>
    concept no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>range <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>     <span class="co1">// 仅用于阐释</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> NoThrowForwardIt<span class="sy1">&gt;</span>
    <span class="kw4">void</span> uninitialized_default_construct<span class="br0">(</span>NoThrowForwardIt first,
                                         NoThrowForwardIt last<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> ExecutionPolicy, <span class="kw1">class</span> NoThrowForwardIt<span class="sy1">&gt;</span>
    <span class="kw4">void</span> uninitialized_default_construct<span class="br0">(</span>ExecutionPolicy<span class="sy3">&amp;&amp;</span> exec,
                                         NoThrowForwardIt first,
                                         NoThrowForwardIt last<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> NoThrowForwardIt, <span class="kw1">class</span> Size<span class="sy1">&gt;</span>
    NoThrowForwardIt
      uninitialized_default_construct_n<span class="br0">(</span>NoThrowForwardIt first, Size n<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> ExecutionPolicy, <span class="kw1">class</span> NoThrowForwardIt, <span class="kw1">class</span> Size<span class="sy1">&gt;</span>
    NoThrowForwardIt
      uninitialized_default_construct_n<span class="br0">(</span>ExecutionPolicy<span class="sy3">&amp;&amp;</span> exec,
                                        NoThrowForwardIt first, Size n<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="kw1">namespace</span> ranges <span class="br0">{</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span>no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>iterator I, no<span class="sy2">-</span>throw<span class="sy2">-</span>sentinel<span class="sy2">-</span><span class="kw1">for</span><span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> S<span class="sy1">&gt;</span>
      requires default_­initializable<span class="sy1">&lt;</span>iter_value_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;&gt;</span>
        I uninitialized_default_construct<span class="br0">(</span>I first, S last<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span>no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>range R<span class="sy1">&gt;</span>
      requires default_­initializable<span class="sy1">&lt;</span>range_value_t<span class="sy1">&lt;</span>R<span class="sy1">&gt;&gt;</span>
        borrowed_iterator_t<span class="sy1">&lt;</span>R<span class="sy1">&gt;</span> uninitialized_default_construct<span class="br0">(</span>R<span class="sy3">&amp;&amp;</span> r<span class="br0">)</span><span class="sy4">;</span>
 
    <span class="kw1">template</span><span class="sy1">&lt;</span>no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>iterator I<span class="sy1">&gt;</span>
      requires default_­initializable<span class="sy1">&lt;</span>iter_value_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;&gt;</span>
        I uninitialized_default_construct_n<span class="br0">(</span>I first, iter_difference_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> n<span class="br0">)</span><span class="sy4">;</span>
  <span class="br0">}</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> NoThrowForwardIterator<span class="sy1">&gt;</span>
    <span class="kw4">void</span> uninitialized_value_construct<span class="br0">(</span>NoThrowForwardIterator first,
                                       NoThrowForwardIterator last<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> ExecutionPolicy, <span class="kw1">class</span> NoThrowForwardIt<span class="sy1">&gt;</span>
    <span class="kw4">void</span> uninitialized_value_construct<span class="br0">(</span>ExecutionPolicy<span class="sy3">&amp;&amp;</span> exec,
                                       NoThrowForwardIt first,
                                       NoThrowForwardIt last<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> NoThrowForwardIt, <span class="kw1">class</span> Size<span class="sy1">&gt;</span>
    NoThrowForwardIt
      uninitialized_value_construct_n<span class="br0">(</span>NoThrowForwardIt first, Size n<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> ExecutionPolicy, <span class="kw1">class</span> NoThrowForwardIt, <span class="kw1">class</span> Size<span class="sy1">&gt;</span>
    NoThrowForwardIt
      uninitialized_value_construct_n<span class="br0">(</span>ExecutionPolicy<span class="sy3">&amp;&amp;</span> exec,
                                      NoThrowForwardIt first, Size n<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="kw1">namespace</span> ranges <span class="br0">{</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span>no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>iterator I, no<span class="sy2">-</span>throw<span class="sy2">-</span>sentinel<span class="sy2">-</span><span class="kw1">for</span><span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> S<span class="sy1">&gt;</span>
      requires default_­initializable<span class="sy1">&lt;</span>iter_value_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;&gt;</span>
        I uninitialized_value_construct<span class="br0">(</span>I first, S last<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span>no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>range R<span class="sy1">&gt;</span>
      requires default_­initializable<span class="sy1">&lt;</span>range_value_t<span class="sy1">&lt;</span>R<span class="sy1">&gt;&gt;</span>
        borrowed_iterator_t<span class="sy1">&lt;</span>R<span class="sy1">&gt;</span> uninitialized_value_construct<span class="br0">(</span>R<span class="sy3">&amp;&amp;</span> r<span class="br0">)</span><span class="sy4">;</span>
 
    <span class="kw1">template</span><span class="sy1">&lt;</span>no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>iterator I<span class="sy1">&gt;</span>
      requires default_­initializable<span class="sy1">&lt;</span>iter_value_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;&gt;</span>
        I uninitialized_value_construct_n<span class="br0">(</span>I first, iter_difference_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> n<span class="br0">)</span><span class="sy4">;</span>
  <span class="br0">}</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> InputIt, <span class="kw1">class</span> NoThrowForwardIt<span class="sy1">&gt;</span>
    NoThrowForwardIt uninitialized_copy<span class="br0">(</span>InputIt first, InputIt last,
                                        NoThrowForwardIt result<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> ExecutionPolicy, <span class="kw1">class</span> ForwardIt, <span class="kw1">class</span> NoThrowForwardIt<span class="sy1">&gt;</span>
    NoThrowForwardIt uninitialized_copy<span class="br0">(</span>ExecutionPolicy<span class="sy3">&amp;&amp;</span> exec,
                                        ForwardIt first, ForwardIt last,
                                        NoThrowForwardIt result<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> InputIt, <span class="kw1">class</span> Size, <span class="kw1">class</span> NoThrowForwardIt<span class="sy1">&gt;</span>
    NoThrowForwardIt uninitialized_copy_n<span class="br0">(</span>InputIt first, Size n,
                                          NoThrowForwardIt result<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> ExecutionPolicy, <span class="kw1">class</span> ForwardIt, <span class="kw1">class</span> Size,
           <span class="kw1">class</span> NoThrowForwardIt<span class="sy1">&gt;</span>
    NoThrowForwardIt uninitialized_copy_n<span class="br0">(</span>ExecutionPolicy<span class="sy3">&amp;&amp;</span> exec,
                                          ForwardIt first, Size n,
                                          NoThrowForwardIt result<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="kw1">namespace</span> ranges <span class="br0">{</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> I, <span class="kw1">class</span> O<span class="sy1">&gt;</span>
      <span class="kw1">using</span> uninitialized_copy_result <span class="sy1">=</span> in_out_result<span class="sy1">&lt;</span>I, O<span class="sy1">&gt;</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span>input_­iterator I, sentinel_­<span class="kw1">for</span><span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> S1,
             no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>iterator O, no<span class="sy2">-</span>throw<span class="sy2">-</span>sentinel<span class="sy2">-</span><span class="kw1">for</span><span class="sy1">&lt;</span>O<span class="sy1">&gt;</span> S2<span class="sy1">&gt;</span>
      requires constructible_­from<span class="sy1">&lt;</span>iter_value_t<span class="sy1">&lt;</span>O<span class="sy1">&gt;</span>, iter_reference_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;&gt;</span>
        uninitialized_copy_result<span class="sy1">&lt;</span>I, O<span class="sy1">&gt;</span>
          uninitialized_copy<span class="br0">(</span>I ifirst, S1 ilast, O ofirst, S2 olast<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span>input_­range IR, no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>range OR<span class="sy1">&gt;</span>
      requires constructible_­from<span class="sy1">&lt;</span>range_value_t<span class="sy1">&lt;</span>OR<span class="sy1">&gt;</span>, range_reference_t<span class="sy1">&lt;</span>IR<span class="sy1">&gt;&gt;</span>
        uninitialized_copy_result<span class="sy1">&lt;</span>borrowed_iterator_t<span class="sy1">&lt;</span>IR<span class="sy1">&gt;</span>, borrowed_iterator_t<span class="sy1">&lt;</span>OR<span class="sy1">&gt;&gt;</span>
          uninitialized_copy<span class="br0">(</span>IR<span class="sy3">&amp;&amp;</span> in_range, OR<span class="sy3">&amp;&amp;</span> out_range<span class="br0">)</span><span class="sy4">;</span>
 
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> I, <span class="kw1">class</span> O<span class="sy1">&gt;</span>
      <span class="kw1">using</span> uninitialized_copy_n_result <span class="sy1">=</span> in_out_result<span class="sy1">&lt;</span>I, O<span class="sy1">&gt;</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span>input_­iterator I, no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>iterator O, no<span class="sy2">-</span>throw<span class="sy2">-</span>sentinel<span class="sy2">-</span><span class="kw1">for</span><span class="sy1">&lt;</span>O<span class="sy1">&gt;</span> S<span class="sy1">&gt;</span>
      requires constructible_­from<span class="sy1">&lt;</span>iter_value_t<span class="sy1">&lt;</span>O<span class="sy1">&gt;</span>, iter_reference_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;&gt;</span>
        uninitialized_copy_n_result<span class="sy1">&lt;</span>I, O<span class="sy1">&gt;</span>
          uninitialized_copy_n<span class="br0">(</span>I ifirst, iter_difference_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> n, O ofirst, S olast<span class="br0">)</span><span class="sy4">;</span>
  <span class="br0">}</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> InputIt, <span class="kw1">class</span> NoThrowForwardIt<span class="sy1">&gt;</span>
    NoThrowForwardIt uninitialized_move<span class="br0">(</span>InputIt first, InputIt last,
                                        NoThrowForwardIt result<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> ExecutionPolicy, <span class="kw1">class</span> ForwardIt, <span class="kw1">class</span> NoThrowForwardIt<span class="sy1">&gt;</span>
    NoThrowForwardIt uninitialized_move<span class="br0">(</span>ExecutionPolicy<span class="sy3">&amp;&amp;</span> exec,
                                        ForwardIt first, ForwardIt last,
                                        NoThrowForwardIt result<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> InputIt, <span class="kw1">class</span> Size, <span class="kw1">class</span> NoThrowForwardIt<span class="sy1">&gt;</span>
    pair<span class="sy1">&lt;</span>InputIt, NoThrowForwardIt<span class="sy1">&gt;</span>
      uninitialized_move_n<span class="br0">(</span>InputIt first, Size n, NoThrowForwardIt result<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> ExecutionPolicy, <span class="kw1">class</span> ForwardIt, <span class="kw1">class</span> Size,
           <span class="kw1">class</span> NoThrowForwardIt<span class="sy1">&gt;</span>
    pair<span class="sy1">&lt;</span>ForwardIt, NoThrowForwardIt<span class="sy1">&gt;</span>
      uninitialized_move_n<span class="br0">(</span>ExecutionPolicy<span class="sy3">&amp;&amp;</span> exec,
                           ForwardIt first, Size n, NoThrowForwardIt result<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="kw1">namespace</span> ranges <span class="br0">{</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> I, <span class="kw1">class</span> O<span class="sy1">&gt;</span>
      <span class="kw1">using</span> uninitialized_move_result <span class="sy1">=</span> in_out_result<span class="sy1">&lt;</span>I, O<span class="sy1">&gt;</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span>input_­iterator I, sentinel_­<span class="kw1">for</span><span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> S1,
             no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>iterator O, no<span class="sy2">-</span>throw<span class="sy2">-</span>sentinel<span class="sy2">-</span><span class="kw1">for</span><span class="sy1">&lt;</span>O<span class="sy1">&gt;</span> S2<span class="sy1">&gt;</span>
      requires constructible_­from<span class="sy1">&lt;</span>iter_value_t<span class="sy1">&lt;</span>O<span class="sy1">&gt;</span>, iter_rvalue_reference_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;&gt;</span>
        uninitialized_move_result<span class="sy1">&lt;</span>I, O<span class="sy1">&gt;</span>
          uninitialized_move<span class="br0">(</span>I ifirst, S1 ilast, O ofirst, S2 olast<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span>input_­range IR, no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>range OR<span class="sy1">&gt;</span>
      requires constructible_­from<span class="sy1">&lt;</span>range_value_t<span class="sy1">&lt;</span>OR<span class="sy1">&gt;</span>, range_rvalue_reference_t<span class="sy1">&lt;</span>IR<span class="sy1">&gt;&gt;</span>
        uninitialized_move_result<span class="sy1">&lt;</span>borrowed_iterator_t<span class="sy1">&lt;</span>IR<span class="sy1">&gt;</span>, borrowed_iterator_t<span class="sy1">&lt;</span>OR<span class="sy1">&gt;&gt;</span>
          uninitialized_move<span class="br0">(</span>IR<span class="sy3">&amp;&amp;</span> in_range, OR<span class="sy3">&amp;&amp;</span> out_range<span class="br0">)</span><span class="sy4">;</span>
 
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> I, <span class="kw1">class</span> O<span class="sy1">&gt;</span>
      <span class="kw1">using</span> uninitialized_move_n_result <span class="sy1">=</span> in_out_result<span class="sy1">&lt;</span>I, O<span class="sy1">&gt;</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span>input_­iterator I,
             no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>iterator O, no<span class="sy2">-</span>throw<span class="sy2">-</span>sentinel<span class="sy2">-</span><span class="kw1">for</span><span class="sy1">&lt;</span>O<span class="sy1">&gt;</span> S<span class="sy1">&gt;</span>
      requires constructible_­from<span class="sy1">&lt;</span>iter_value_t<span class="sy1">&lt;</span>O<span class="sy1">&gt;</span>, iter_rvalue_reference_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;&gt;</span>
        uninitialized_move_n_result<span class="sy1">&lt;</span>I, O<span class="sy1">&gt;</span>
          uninitialized_move_n<span class="br0">(</span>I ifirst, iter_difference_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> n, O ofirst, S olast<span class="br0">)</span><span class="sy4">;</span>
  <span class="br0">}</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> NoThrowForwardIt, <span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">void</span> uninitialized_fill<span class="br0">(</span>NoThrowForwardIt first, NoThrowForwardIt last,
                            <span class="kw4">const</span> T<span class="sy3">&amp;</span> x<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> ExecutionPolicy, <span class="kw1">class</span> NoThrowForwardIt, <span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">void</span> uninitialized_fill<span class="br0">(</span>ExecutionPolicy<span class="sy3">&amp;&amp;</span> exec,
                            NoThrowForwardIt first, NoThrowForwardIt last,
                            <span class="kw4">const</span> T<span class="sy3">&amp;</span> x<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> NoThrowForwardIt, <span class="kw1">class</span> Size, <span class="kw1">class</span> T<span class="sy1">&gt;</span>
    NoThrowForwardIt
      uninitialized_fill_n<span class="br0">(</span>NoThrowForwardIt first, Size n, <span class="kw4">const</span> T<span class="sy3">&amp;</span> x<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> ExecutionPolicy, <span class="kw1">class</span> NoThrowForwardIt, <span class="kw1">class</span> Size, <span class="kw1">class</span> T<span class="sy1">&gt;</span>
    NoThrowForwardIt
      uninitialized_fill_n<span class="br0">(</span>ExecutionPolicy<span class="sy3">&amp;&amp;</span> exec,
                           NoThrowForwardIt first, Size n, <span class="kw4">const</span> T<span class="sy3">&amp;</span> x<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="kw1">namespace</span> ranges <span class="br0">{</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span>no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>iterator I, no<span class="sy2">-</span>throw<span class="sy2">-</span>sentinel<span class="sy2">-</span><span class="kw1">for</span><span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> S, <span class="kw1">class</span> T<span class="sy1">&gt;</span>
      requires constructible_­from<span class="sy1">&lt;</span>iter_value_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;</span>, <span class="kw4">const</span> T<span class="sy3">&amp;</span><span class="sy1">&gt;</span>
        I uninitialized_fill<span class="br0">(</span>I first, S last, <span class="kw4">const</span> T<span class="sy3">&amp;</span> x<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span>no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>range R, <span class="kw1">class</span> T<span class="sy1">&gt;</span>
      requires constructible_­from<span class="sy1">&lt;</span>range_value_t<span class="sy1">&lt;</span>R<span class="sy1">&gt;</span>, <span class="kw4">const</span> T<span class="sy3">&amp;</span><span class="sy1">&gt;</span>
        borrowed_iterator_t<span class="sy1">&lt;</span>R<span class="sy1">&gt;</span> uninitialized_fill<span class="br0">(</span>R<span class="sy3">&amp;&amp;</span> r, <span class="kw4">const</span> T<span class="sy3">&amp;</span> x<span class="br0">)</span><span class="sy4">;</span>
 
    <span class="kw1">template</span><span class="sy1">&lt;</span>no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>iterator I, <span class="kw1">class</span> T<span class="sy1">&gt;</span>
      requires constructible_­from<span class="sy1">&lt;</span>iter_value_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;</span>, <span class="kw4">const</span> T<span class="sy3">&amp;</span><span class="sy1">&gt;</span>
        I uninitialized_fill_n<span class="br0">(</span>I first, iter_difference_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> n, <span class="kw4">const</span> T<span class="sy3">&amp;</span> x<span class="br0">)</span><span class="sy4">;</span>
  <span class="br0">}</span>
 
  <span class="co1">// construct_­at</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> T<span class="sy2">*</span> construct_at<span class="br0">(</span>T<span class="sy2">*</span> location, Args<span class="sy3">&amp;&amp;</span>... <span class="me1">args</span><span class="br0">)</span><span class="sy4">;</span>
 
  <span class="kw1">namespace</span> ranges <span class="br0">{</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
      <span class="kw4">constexpr</span> T<span class="sy2">*</span> construct_at<span class="br0">(</span>T<span class="sy2">*</span> location, Args<span class="sy3">&amp;&amp;</span>... <span class="me1">args</span><span class="br0">)</span><span class="sy4">;</span>
  <span class="br0">}</span>
 
  <span class="co1">// destroy</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> <span class="kw4">void</span> destroy_at<span class="br0">(</span>T<span class="sy2">*</span> location<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> NoThrowForwardIt<span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> <span class="kw4">void</span> destroy<span class="br0">(</span>NoThrowForwardIt first, NoThrowForwardIt last<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> ExecutionPolicy, <span class="kw1">class</span> NoThrowForwardIt<span class="sy1">&gt;</span>
    <span class="kw4">void</span> destroy<span class="br0">(</span>ExecutionPolicy<span class="sy3">&amp;&amp;</span> exec,
                 NoThrowForwardIt first, NoThrowForwardIt last<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> NoThrowForwardIt, <span class="kw1">class</span> Size<span class="sy1">&gt;</span>
    <span class="kw4">constexpr</span> NoThrowForwardIt destroy_n<span class="br0">(</span>NoThrowForwardIt first, Size n<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> ExecutionPolicy, <span class="kw1">class</span> NoThrowForwardIt, <span class="kw1">class</span> Size<span class="sy1">&gt;</span>
    NoThrowForwardIt destroy_n<span class="br0">(</span>ExecutionPolicy<span class="sy3">&amp;&amp;</span> exec,
                               NoThrowForwardIt first, Size n<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="kw1">namespace</span> ranges <span class="br0">{</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span>destructible T<span class="sy1">&gt;</span>
      <span class="kw4">constexpr</span> <span class="kw4">void</span> destroy_at<span class="br0">(</span>T<span class="sy2">*</span> location<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="kw1">template</span><span class="sy1">&lt;</span>no<span class="sy2">-</span>throw<span class="sy2">-</span>input<span class="sy2">-</span>iterator I, no<span class="sy2">-</span>throw<span class="sy2">-</span>sentinel<span class="sy2">-</span><span class="kw1">for</span><span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> S<span class="sy1">&gt;</span>
      requires destructible<span class="sy1">&lt;</span>iter_value_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;&gt;</span>
        <span class="kw4">constexpr</span> I destroy<span class="br0">(</span>I first, S last<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span>no<span class="sy2">-</span>throw<span class="sy2">-</span>input<span class="sy2">-</span>range R<span class="sy1">&gt;</span>
      requires destructible<span class="sy1">&lt;</span>range_value_t<span class="sy1">&lt;</span>R<span class="sy1">&gt;&gt;</span>
        <span class="kw4">constexpr</span> borrowed_iterator_t<span class="sy1">&lt;</span>R<span class="sy1">&gt;</span> destroy<span class="br0">(</span>R<span class="sy3">&amp;&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="kw1">template</span><span class="sy1">&lt;</span>no<span class="sy2">-</span>throw<span class="sy2">-</span>input<span class="sy2">-</span>iterator I<span class="sy1">&gt;</span>
      requires destructible<span class="sy1">&lt;</span>iter_value_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;&gt;</span>
        <span class="kw4">constexpr</span> I destroy_n<span class="br0">(</span>I first, iter_difference_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> n<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="br0">}</span>
 
  <span class="co1">// 类模板 unique_­ptr</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> default_delete<span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> default_delete<span class="sy1">&lt;</span>T<span class="br0">[</span><span class="br0">]</span><span class="sy1">&gt;</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D <span class="sy1">=</span> default_delete<span class="sy1">&lt;</span>T<span class="sy1">&gt;&gt;</span> <span class="kw1">class</span> unique_ptr<span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span> <span class="kw1">class</span> unique_ptr<span class="sy1">&lt;</span>T<span class="br0">[</span><span class="br0">]</span>, D<span class="sy1">&gt;</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
    unique_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> make_unique<span class="br0">(</span>Args<span class="sy3">&amp;&amp;</span>... <span class="me1">args</span><span class="br0">)</span><span class="sy4">;</span>                                  <span class="co1">// T 非数组</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    unique_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> make_unique<span class="br0">(</span>size_t n<span class="br0">)</span><span class="sy4">;</span>                                        <span class="co1">// T 为 U[]</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
    <span class="coMULTI">/* 未指明 */</span> make_unique<span class="br0">(</span>Args<span class="sy3">&amp;&amp;</span>...<span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span>                                <span class="co1">// T 为 U[N]</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    unique_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> make_unique_for_overwrite<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>                                  <span class="co1">// T 非数组</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    unique_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> make_unique_for_overwrite<span class="br0">(</span>size_t n<span class="br0">)</span><span class="sy4">;</span>                          <span class="co1">// T 为 U[]</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
    <span class="coMULTI">/* 未指明 */</span> make_unique_for_overwrite<span class="br0">(</span>Args<span class="sy3">&amp;&amp;</span>...<span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span>                  <span class="co1">// T 为 U[N]</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
    <span class="kw4">void</span> swap<span class="br0">(</span>unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="sy3">&amp;</span> y<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T1, <span class="kw1">class</span> D1, <span class="kw1">class</span> T2, <span class="kw1">class</span> D2<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">==</span><span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T1, D1<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, <span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T2, D2<span class="sy1">&gt;</span><span class="sy3">&amp;</span> y<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T1, <span class="kw1">class</span> D1, <span class="kw1">class</span> T2, <span class="kw1">class</span> D2<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">&lt;</span><span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T1, D1<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, <span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T2, D2<span class="sy1">&gt;</span><span class="sy3">&amp;</span> y<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T1, <span class="kw1">class</span> D1, <span class="kw1">class</span> T2, <span class="kw1">class</span> D2<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">&gt;</span><span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T1, D1<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, <span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T2, D2<span class="sy1">&gt;</span><span class="sy3">&amp;</span> y<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T1, <span class="kw1">class</span> D1, <span class="kw1">class</span> T2, <span class="kw1">class</span> D2<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">&lt;=</span><span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T1, D1<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, <span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T2, D2<span class="sy1">&gt;</span><span class="sy3">&amp;</span> y<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T1, <span class="kw1">class</span> D1, <span class="kw1">class</span> T2, <span class="kw1">class</span> D2<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">&gt;=</span><span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T1, D1<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, <span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T2, D2<span class="sy1">&gt;</span><span class="sy3">&amp;</span> y<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T1, <span class="kw1">class</span> D1, <span class="kw1">class</span> T2, <span class="kw1">class</span> D2<span class="sy1">&gt;</span>
    requires three_­way_­comparable_­with<span class="sy1">&lt;</span><span class="kw1">typename</span> unique_ptr<span class="sy1">&lt;</span>T1, D1<span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">pointer</span>,
                                       <span class="kw1">typename</span> unique_ptr<span class="sy1">&lt;</span>T2, D2<span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">pointer</span><span class="sy1">&gt;</span>
    compare_three_way_result_t<span class="sy1">&lt;</span><span class="kw1">typename</span> unique_ptr<span class="sy1">&lt;</span>T1, D1<span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">pointer</span>,
                               <span class="kw1">typename</span> unique_ptr<span class="sy1">&lt;</span>T2, D2<span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">pointer</span><span class="sy1">&gt;</span>
      operator<span class="sy1">&lt;=&gt;</span><span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T1, D1<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, <span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T2, D2<span class="sy1">&gt;</span><span class="sy3">&amp;</span> y<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">==</span><span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, nullptr_t<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">&lt;</span><span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, nullptr_t<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">&lt;</span><span class="br0">(</span>nullptr_t, <span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="sy3">&amp;</span> y<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">&gt;</span><span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, nullptr_t<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">&gt;</span><span class="br0">(</span>nullptr_t, <span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="sy3">&amp;</span> y<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">&lt;=</span><span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, nullptr_t<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">&lt;=</span><span class="br0">(</span>nullptr_t, <span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="sy3">&amp;</span> y<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">&gt;=</span><span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, nullptr_t<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">&gt;=</span><span class="br0">(</span>nullptr_t, <span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="sy3">&amp;</span> y<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
    requires three_­way_­comparable<span class="sy1">&lt;</span><span class="kw1">typename</span> unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">pointer</span><span class="sy1">&gt;</span>
    compare_three_way_result_t<span class="sy1">&lt;</span><span class="kw1">typename</span> unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">pointer</span><span class="sy1">&gt;</span>
      operator<span class="sy1">&lt;=&gt;</span><span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, nullptr_t<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> E, <span class="kw1">class</span> T, <span class="kw1">class</span> Y, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
    basic_ostream<span class="sy1">&lt;</span>E, T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> operator<span class="sy1">&lt;&lt;</span><span class="br0">(</span>basic_ostream<span class="sy1">&lt;</span>E, T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> os, <span class="kw4">const</span> unique_ptr<span class="sy1">&lt;</span>Y, D<span class="sy1">&gt;</span><span class="sy3">&amp;</span> p<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="co1">// 类 bad_­weak_­ptr</span>
  <span class="kw1">class</span> bad_weak_ptr<span class="sy4">;</span>
 
  <span class="co1">// 类模板 shared_­ptr</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">class</span> shared_ptr<span class="sy4">;</span>
 
  <span class="co1">// shared_­ptr 创建</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> make_shared<span class="br0">(</span>Args<span class="sy3">&amp;&amp;</span>... <span class="me1">args</span><span class="br0">)</span><span class="sy4">;</span>                                  <span class="co1">// T 非数组</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> A, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> allocate_shared<span class="br0">(</span><span class="kw4">const</span> A<span class="sy3">&amp;</span> a, Args<span class="sy3">&amp;&amp;</span>... <span class="me1">args</span><span class="br0">)</span><span class="sy4">;</span>                  <span class="co1">// T 非数组</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> make_shared<span class="br0">(</span>size_t N<span class="br0">)</span><span class="sy4">;</span>                                        <span class="co1">// T 为 U[]</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> A<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> allocate_shared<span class="br0">(</span><span class="kw4">const</span> A<span class="sy3">&amp;</span> a, size_t N<span class="br0">)</span><span class="sy4">;</span>                        <span class="co1">// T 为 U[]</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> make_shared<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>                                                <span class="co1">// T 为 U[N]</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> A<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> allocate_shared<span class="br0">(</span><span class="kw4">const</span> A<span class="sy3">&amp;</span> a<span class="br0">)</span><span class="sy4">;</span>                                  <span class="co1">// T 为 U[N]</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> make_shared<span class="br0">(</span>size_t N, <span class="kw4">const</span> remove_extent_t<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> u<span class="br0">)</span><span class="sy4">;</span>           <span class="co1">// T 为 U[]</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> A<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> allocate_shared<span class="br0">(</span><span class="kw4">const</span> A<span class="sy3">&amp;</span> a, size_t N,
                                  <span class="kw4">const</span> remove_extent_t<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> u<span class="br0">)</span><span class="sy4">;</span>                 <span class="co1">// T 为 U[]</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> make_shared<span class="br0">(</span><span class="kw4">const</span> remove_extent_t<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> u<span class="br0">)</span><span class="sy4">;</span>                     <span class="co1">// T 为 U[N]</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> A<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> allocate_shared<span class="br0">(</span><span class="kw4">const</span> A<span class="sy3">&amp;</span> a, <span class="kw4">const</span> remove_extent_t<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> u<span class="br0">)</span><span class="sy4">;</span>     <span class="co1">// T 为 U[N]</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> make_shared_for_overwrite<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>                                  <span class="co1">// T 非 U[]</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> A<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> allocate_shared_for_overwrite<span class="br0">(</span><span class="kw4">const</span> A<span class="sy3">&amp;</span> a<span class="br0">)</span><span class="sy4">;</span>                    <span class="co1">// T 非 U[]</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> make_shared_for_overwrite<span class="br0">(</span>size_t N<span class="br0">)</span><span class="sy4">;</span>                          <span class="co1">// T 为 U[]</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> A<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> allocate_shared_for_overwrite<span class="br0">(</span><span class="kw4">const</span> A<span class="sy3">&amp;</span> a, size_t N<span class="br0">)</span><span class="sy4">;</span>          <span class="co1">// T 为 U[]</span>
 
  <span class="co1">// shared_­ptr 比较</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">==</span><span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> a, <span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span> b<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
    strong_ordering operator<span class="sy1">&lt;=&gt;</span><span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> a, <span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span> b<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> operator<span class="sy1">==</span><span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, nullptr_t<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    strong_ordering operator<span class="sy1">&lt;=&gt;</span><span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> x, nullptr_t<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
  <span class="co1">// shared_­ptr 特化算法</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">void</span> swap<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> a, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> b<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
  <span class="co1">// shared_­ptr 转型</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> static_pointer_cast<span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> static_pointer_cast<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> dynamic_pointer_cast<span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> dynamic_pointer_cast<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> const_pointer_cast<span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> const_pointer_cast<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> reinterpret_pointer_cast<span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> reinterpret_pointer_cast<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
  <span class="co1">// shared_­ptr get_­deleter</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> D, <span class="kw1">class</span> T<span class="sy1">&gt;</span>
    D<span class="sy2">*</span> get_deleter<span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> p<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
  <span class="co1">// shared_­ptr I/O</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> E, <span class="kw1">class</span> T, <span class="kw1">class</span> Y<span class="sy1">&gt;</span>
    basic_ostream<span class="sy1">&lt;</span>E, T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> operator<span class="sy1">&lt;&lt;</span><span class="br0">(</span>basic_ostream<span class="sy1">&lt;</span>E, T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> os, <span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>Y<span class="sy1">&gt;</span><span class="sy3">&amp;</span> p<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="co1">// 类模板 weak_­ptr</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">class</span> weak_ptr<span class="sy4">;</span>
 
  <span class="co1">// weak_­ptr 特化算法</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw4">void</span> swap<span class="br0">(</span>weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> a, weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> b<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
  <span class="co1">// 类模板 owner_­less</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T <span class="sy1">=</span> <span class="kw4">void</span><span class="sy1">&gt;</span> <span class="kw1">struct</span> owner_less<span class="sy4">;</span>
 
  <span class="co1">// 类模板 enable_­shared_­from_­this</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">class</span> enable_shared_from_this<span class="sy4">;</span>
 
  <span class="co1">// 散列支持</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> hash<span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span> <span class="kw1">struct</span> hash<span class="sy1">&lt;</span>unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;&gt;</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> hash<span class="sy1">&lt;</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;&gt;</span><span class="sy4">;</span>
 
  <span class="co1">// 原子智能指针</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> atomic<span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> atomic<span class="sy1">&lt;</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;&gt;</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> atomic<span class="sy1">&lt;</span>weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;&gt;</span><span class="sy4">;</span>
 
  <span class="co1">// 类模板 out_­ptr_­t</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Smart, <span class="kw1">class</span> Pointer, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
    <span class="kw1">class</span> out_ptr_t<span class="sy4">;</span>
 
  <span class="co1">// 函数模板 out_­ptr</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Pointer <span class="sy1">=</span> <span class="kw4">void</span>, <span class="kw1">class</span> Smart, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
    <span class="kw4">auto</span> out_ptr<span class="br0">(</span>Smart<span class="sy3">&amp;</span> s, Args<span class="sy3">&amp;&amp;</span>... <span class="me1">args</span><span class="br0">)</span><span class="sy4">;</span>
 
  <span class="co1">// 类模板 inout_­ptr_­t</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Smart, <span class="kw1">class</span> Pointer, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
    <span class="kw1">class</span> inout_ptr_t<span class="sy4">;</span>
 
  <span class="co1">// 函数模板 inout_­ptr</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Pointer <span class="sy1">=</span> <span class="kw4">void</span>, <span class="kw1">class</span> Smart, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
    <span class="kw4">auto</span> inout_ptr<span class="br0">(</span>Smart<span class="sy3">&amp;</span> s, Args<span class="sy3">&amp;&amp;</span>... <span class="me1">args</span><span class="br0">)</span><span class="sy4">;</span>
<span class="br0">}</span>
 
<span class="co1">// 弃用</span>
<span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> atomic_is_lock_free<span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> p<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> atomic_load<span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> p<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> atomic_load_explicit<span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> p, memory_order mo<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">void</span> atomic_store<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> p, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> r<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">void</span> atomic_store_explicit<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> p, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> r, memory_order mo<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> atomic_exchange<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> p, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> r<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> atomic_exchange_explicit<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> p, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> r, memory_order mo<span class="br0">)</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> atomic_compare_exchange_weak<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> p, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> v, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> w<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> atomic_compare_exchange_strong<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> p, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> v, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> w<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> atomic_compare_exchange_weak_explicit<span class="br0">(</span>
      shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> p, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> v, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> w,
      memory_order success, memory_order failure<span class="br0">)</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    <span class="kw4">bool</span> atomic_compare_exchange_strong_explicit<span class="br0">(</span>
      shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> p, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy2">*</span> v, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> w,
      memory_order success, memory_order failure<span class="br0">)</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E8.BE.85.E5.8A.A9.E6.A6.82.E5.BF.B5">辅助概念</span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> I<span class="sy1">&gt;</span>
concept no<span class="sy2">-</span>throw<span class="sy2">-</span>input<span class="sy2">-</span>iterator <span class="sy1">=</span> <span class="co1">// 仅用于阐释</span>
  input_iterator<span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> <span class="sy3">&amp;&amp;</span>
  is_lvalue_reference_v<span class="sy1">&lt;</span>iter_reference_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;&gt;</span> <span class="sy3">&amp;&amp;</span>
  same_as<span class="sy1">&lt;</span>remove_cvref_t<span class="sy1">&lt;</span>iter_reference_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;&gt;</span>, iter_value_t<span class="sy1">&lt;</span>I<span class="sy1">&gt;&gt;</span><span class="sy4">;</span>
 
<span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> S, <span class="kw1">class</span> I<span class="sy1">&gt;</span>
concept no<span class="sy2">-</span>throw<span class="sy2">-</span>sentinel<span class="sy2">-</span><span class="kw1">for</span> <span class="sy1">=</span> sentinel_for<span class="sy1">&lt;</span>S, I<span class="sy1">&gt;</span><span class="sy4">;</span> <span class="co1">// 仅用于阐释</span>
 
<span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> R<span class="sy1">&gt;</span>
concept no<span class="sy2">-</span>throw<span class="sy2">-</span>input<span class="sy2">-</span>range <span class="sy1">=</span> <span class="co1">// 仅用于阐释</span>
  ranges<span class="sy4">::</span><span class="me2">range</span><span class="sy1">&lt;</span>R<span class="sy1">&gt;</span> <span class="sy3">&amp;&amp;</span>
  no<span class="sy2">-</span>throw<span class="sy2">-</span>input<span class="sy2">-</span>iterator<span class="sy1">&lt;</span>ranges<span class="sy4">::</span><span class="me2">iterator_t</span><span class="sy1">&lt;</span>R<span class="sy1">&gt;&gt;</span> <span class="sy3">&amp;&amp;</span>
  no<span class="sy2">-</span>throw<span class="sy2">-</span>sentinel<span class="sy2">-</span><span class="kw1">for</span><span class="sy1">&lt;</span>ranges<span class="sy4">::</span><span class="me2">sentinel_t</span><span class="sy1">&lt;</span>R<span class="sy1">&gt;</span>, ranges<span class="sy4">::</span><span class="me2">iterator_t</span><span class="sy1">&lt;</span>R<span class="sy1">&gt;&gt;</span><span class="sy4">;</span>
 
<span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> I<span class="sy1">&gt;</span>
concept no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>iterator <span class="sy1">=</span> <span class="co1">// 仅用于阐释</span>
  no<span class="sy2">-</span>throw<span class="sy2">-</span>input<span class="sy2">-</span>iterator<span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> <span class="sy3">&amp;&amp;</span>
  forward_iterator<span class="sy1">&lt;</span>I<span class="sy1">&gt;</span> <span class="sy3">&amp;&amp;</span>
  no<span class="sy2">-</span>throw<span class="sy2">-</span>sentinel<span class="sy2">-</span><span class="kw1">for</span><span class="sy1">&lt;</span>I, I<span class="sy1">&gt;</span><span class="sy4">;</span>
 
<span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> R<span class="sy1">&gt;</span>
concept no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>range <span class="sy1">=</span> <span class="co1">// 仅用于阐释</span>
  no<span class="sy2">-</span>throw<span class="sy2">-</span>input<span class="sy2">-</span>range<span class="sy1">&lt;</span>R<span class="sy1">&gt;</span> <span class="sy3">&amp;&amp;</span>
  no<span class="sy2">-</span>throw<span class="sy2">-</span>forward<span class="sy2">-</span>iterator<span class="sy1">&lt;</span>ranges<span class="sy4">::</span><span class="me2">iterator_t</span><span class="sy1">&lt;</span>R<span class="sy1">&gt;&gt;</span><span class="sy4">;</span></pre></div></div>
<p>注意：<a href="../memory/ranges/nothrow_concepts.html" title="cpp/memory/ranges/nothrow concepts">这些名字</a>仅用于阐释，它们不是接口的一部分。
</p>
<h4><span class="mw-headline" id=".E7.B1.BB.E6.A8.A1.E6.9D.BF_std::pointer_traits">类模板 <span class="t-lc"><a href="../memory/pointer_traits.html" title="cpp/memory/pointer traits">std::pointer_traits</a></span></span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Ptr<span class="sy1">&gt;</span> <span class="kw1">struct</span> pointer_traits <span class="br0">{</span>
    <span class="kw1">using</span> pointer         <span class="sy1">=</span> Ptr<span class="sy4">;</span>
    <span class="kw1">using</span> element_type    <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
    <span class="kw1">using</span> difference_type <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
 
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U<span class="sy1">&gt;</span> <span class="kw1">using</span> rebind <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
 
    <span class="kw4">static</span> pointer pointer_to<span class="br0">(</span><span class="coMULTI">/* 见描述 */</span> r<span class="br0">)</span><span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> pointer_traits<span class="sy1">&lt;</span>T<span class="sy2">*</span><span class="sy1">&gt;</span> <span class="br0">{</span>
    <span class="kw1">using</span> pointer         <span class="sy1">=</span> T<span class="sy2">*</span><span class="sy4">;</span>
    <span class="kw1">using</span> element_type    <span class="sy1">=</span> T<span class="sy4">;</span>
    <span class="kw1">using</span> difference_type <span class="sy1">=</span> ptrdiff_t<span class="sy4">;</span>
 
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U<span class="sy1">&gt;</span> <span class="kw1">using</span> rebind <span class="sy1">=</span> U<span class="sy2">*</span><span class="sy4">;</span>
 
    <span class="kw4">static</span> <span class="kw4">constexpr</span> pointer pointer_to<span class="br0">(</span><span class="coMULTI">/* 见描述 */</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E7.B1.BB_std::allocator_arg_t">类 <span class="t-lc"><a href="../memory/allocator_arg_t.html" title="cpp/memory/allocator arg t">std::allocator_arg_t</a></span></span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">struct</span> allocator_arg_t <span class="br0">{</span> <span class="kw1">explicit</span> allocator_arg_t<span class="br0">(</span><span class="br0">)</span> <span class="sy1">=</span> <span class="kw1">default</span><span class="sy4">;</span> <span class="br0">}</span><span class="sy4">;</span>
  <span class="kw1">inline</span> <span class="kw4">constexpr</span> allocator_arg_t allocator_arg<span class="br0">{</span><span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E7.B1.BB.E6.A8.A1.E6.9D.BF_std::allocator_traits">类模板 <span class="t-lc"><a href="../memory/allocator_traits.html" title="cpp/memory/allocator traits">std::allocator_traits</a></span></span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Alloc<span class="sy1">&gt;</span> <span class="kw1">struct</span> allocator_traits <span class="br0">{</span>
    <span class="kw1">using</span> allocator_type     <span class="sy1">=</span> Alloc<span class="sy4">;</span>
 
    <span class="kw1">using</span> value_type         <span class="sy1">=</span> <span class="kw1">typename</span> Alloc<span class="sy4">::</span><span class="me2">value_type</span><span class="sy4">;</span>
 
    <span class="kw1">using</span> pointer            <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
    <span class="kw1">using</span> const_pointer      <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
    <span class="kw1">using</span> void_pointer       <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
    <span class="kw1">using</span> const_void_pointer <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
 
    <span class="kw1">using</span> difference_type    <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
    <span class="kw1">using</span> size_type          <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
 
    <span class="kw1">using</span> propagate_on_container_copy_assignment <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
    <span class="kw1">using</span> propagate_on_container_move_assignment <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
    <span class="kw1">using</span> propagate_on_container_swap            <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
    <span class="kw1">using</span> is_always_equal                        <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
 
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">using</span> rebind_alloc <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">using</span> rebind_traits <span class="sy1">=</span> allocator_traits<span class="sy1">&lt;</span>rebind_alloc<span class="sy1">&lt;</span>T<span class="sy1">&gt;&gt;</span><span class="sy4">;</span>
 
    <span class="br0">[</span><span class="br0">[</span>nodiscard<span class="br0">]</span><span class="br0">]</span> <span class="kw4">static</span> pointer allocate<span class="br0">(</span>Alloc<span class="sy3">&amp;</span> a, size_type n<span class="br0">)</span><span class="sy4">;</span>
    <span class="br0">[</span><span class="br0">[</span>nodiscard<span class="br0">]</span><span class="br0">]</span> <span class="kw4">static</span> pointer allocate<span class="br0">(</span>Alloc<span class="sy3">&amp;</span> a, size_type n,
                                          const_void_pointer hint<span class="br0">)</span><span class="sy4">;</span>
 
    <span class="kw4">static</span> <span class="kw4">void</span> deallocate<span class="br0">(</span>Alloc<span class="sy3">&amp;</span> a, pointer p, size_type n<span class="br0">)</span><span class="sy4">;</span>
 
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
      <span class="kw4">static</span> <span class="kw4">void</span> construct<span class="br0">(</span>Alloc<span class="sy3">&amp;</span> a, T<span class="sy2">*</span> p, Args<span class="sy3">&amp;&amp;</span>... <span class="me1">args</span><span class="br0">)</span><span class="sy4">;</span>
 
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
      <span class="kw4">static</span> <span class="kw4">void</span> destroy<span class="br0">(</span>Alloc<span class="sy3">&amp;</span> a, T<span class="sy2">*</span> p<span class="br0">)</span><span class="sy4">;</span>
 
    <span class="kw4">static</span> size_type max_size<span class="br0">(</span><span class="kw4">const</span> Alloc<span class="sy3">&amp;</span> a<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="kw4">static</span> Alloc select_on_container_copy_construction<span class="br0">(</span><span class="kw4">const</span> Alloc<span class="sy3">&amp;</span> rhs<span class="br0">)</span><span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E7.B1.BB.E6.A8.A1.E6.9D.BF_std::allocator">类模板 <span class="t-lc"><a href="../memory/allocator.html" title="cpp/memory/allocator">std::allocator</a></span></span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">class</span> allocator <span class="br0">{</span>
   <span class="kw1">public</span><span class="sy4">:</span>
    <span class="kw1">using</span> value_type                             <span class="sy1">=</span> T<span class="sy4">;</span>
    <span class="kw1">using</span> size_type                              <span class="sy1">=</span> size_t<span class="sy4">;</span>
    <span class="kw1">using</span> difference_type                        <span class="sy1">=</span> ptrdiff_t<span class="sy4">;</span>
    <span class="kw1">using</span> propagate_on_container_move_assignment <span class="sy1">=</span> true_type<span class="sy4">;</span>
 
    <span class="kw4">constexpr</span> allocator<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">constexpr</span> allocator<span class="br0">(</span><span class="kw4">const</span> allocator<span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U<span class="sy1">&gt;</span> <span class="kw4">constexpr</span> allocator<span class="br0">(</span><span class="kw4">const</span> allocator<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">constexpr</span> ~allocator<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
    <span class="kw4">constexpr</span> allocator<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span><span class="kw4">const</span> allocator<span class="sy3">&amp;</span><span class="br0">)</span> <span class="sy1">=</span> <span class="kw1">default</span><span class="sy4">;</span>
 
    <span class="br0">[</span><span class="br0">[</span>nodiscard<span class="br0">]</span><span class="br0">]</span> <span class="kw4">constexpr</span> T<span class="sy2">*</span> allocate<span class="br0">(</span>size_t n<span class="br0">)</span><span class="sy4">;</span>
    <span class="br0">[</span><span class="br0">[</span>nodiscard<span class="br0">]</span><span class="br0">]</span> <span class="kw4">constexpr</span> allocation_result<span class="sy1">&lt;</span>T<span class="sy2">*</span><span class="sy1">&gt;</span> allocate_at_least<span class="br0">(</span>size_t n<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw4">constexpr</span> <span class="kw4">void</span> deallocate<span class="br0">(</span>T<span class="sy2">*</span> p, size_t n<span class="br0">)</span><span class="sy4">;</span>
 
    <span class="co1">// 弃用</span>
    <span class="kw1">using</span> is_always_equal <span class="sy1">=</span> true_type<span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E7.B1.BB.E6.A8.A1.E6.9D.BF_std::default_delete">类模板 <span class="t-lc"><a href="../memory/default_delete.html" title="cpp/memory/default delete">std::default_delete</a></span></span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> default_delete <span class="br0">{</span>
    <span class="kw4">constexpr</span> default_delete<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span> <span class="sy1">=</span> <span class="kw1">default</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U<span class="sy1">&gt;</span> default_delete<span class="br0">(</span><span class="kw4">const</span> default_delete<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">void</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span>T<span class="sy2">*</span><span class="br0">)</span> <span class="kw4">const</span><span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> default_delete<span class="sy1">&lt;</span>T<span class="br0">[</span><span class="br0">]</span><span class="sy1">&gt;</span> <span class="br0">{</span>
    <span class="kw4">constexpr</span> default_delete<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span> <span class="sy1">=</span> <span class="kw1">default</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U<span class="sy1">&gt;</span> default_delete<span class="br0">(</span><span class="kw4">const</span> default_delete<span class="sy1">&lt;</span>U<span class="br0">[</span><span class="br0">]</span><span class="sy1">&gt;</span><span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U<span class="sy1">&gt;</span> <span class="kw4">void</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span>U<span class="sy2">*</span> ptr<span class="br0">)</span> <span class="kw4">const</span><span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E7.B1.BB.E6.A8.A1.E6.9D.BF_std::unique_ptr">类模板 <span class="t-lc"><a href="../memory/unique_ptr.html" title="cpp/memory/unique ptr">std::unique_ptr</a></span></span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D <span class="sy1">=</span> default_delete<span class="sy1">&lt;</span>T<span class="sy1">&gt;&gt;</span> <span class="kw1">class</span> unique_ptr <span class="br0">{</span>
  <span class="kw1">public</span><span class="sy4">:</span>
    <span class="kw1">using</span> pointer      <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
    <span class="kw1">using</span> element_type <span class="sy1">=</span> T<span class="sy4">;</span>
    <span class="kw1">using</span> deleter_type <span class="sy1">=</span> D<span class="sy4">;</span>
 
    <span class="co1">// 构造函数</span>
    <span class="kw4">constexpr</span> unique_ptr<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">explicit</span> unique_ptr<span class="br0">(</span>pointer p<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    unique_ptr<span class="br0">(</span>pointer p, <span class="coMULTI">/* 见描述 */</span> d1<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    unique_ptr<span class="br0">(</span>pointer p, <span class="coMULTI">/* 见描述 */</span> d2<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    unique_ptr<span class="br0">(</span>unique_ptr<span class="sy3">&amp;&amp;</span> u<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">constexpr</span> unique_ptr<span class="br0">(</span>nullptr_t<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U, <span class="kw1">class</span> E<span class="sy1">&gt;</span>
      unique_ptr<span class="br0">(</span>unique_ptr<span class="sy1">&lt;</span>U, E<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> u<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="co1">// 析构函数</span>
    ~unique_ptr<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
 
    <span class="co1">// 赋值</span>
    unique_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span>unique_ptr<span class="sy3">&amp;&amp;</span> u<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U, <span class="kw1">class</span> E<span class="sy1">&gt;</span>
      unique_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span>unique_ptr<span class="sy1">&lt;</span>U, E<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> u<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    unique_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span>nullptr_t<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="co1">// 观察器</span>
    add_lvalue_reference_t<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> operator<span class="sy2">*</span><span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="br0">(</span><span class="coMULTI">/* 见描述 */</span><span class="br0">)</span><span class="sy4">;</span>
    pointer operator<span class="sy2">-</span><span class="sy1">&gt;</span><span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    pointer get<span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    deleter_type<span class="sy3">&amp;</span> get_deleter<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">const</span> deleter_type<span class="sy3">&amp;</span> get_deleter<span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">explicit</span> operator <span class="kw4">bool</span><span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="co1">// 修改器</span>
    pointer release<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">void</span> reset<span class="br0">(</span>pointer p <span class="sy1">=</span> pointer<span class="br0">(</span><span class="br0">)</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">void</span> swap<span class="br0">(</span>unique_ptr<span class="sy3">&amp;</span> u<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="co1">// 禁用从左值复制</span>
    unique_ptr<span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy3">&amp;</span><span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span>
    unique_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy3">&amp;</span><span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span> <span class="kw1">class</span> unique_ptr<span class="sy1">&lt;</span>T<span class="br0">[</span><span class="br0">]</span>, D<span class="sy1">&gt;</span> <span class="br0">{</span>
  <span class="kw1">public</span><span class="sy4">:</span>
    <span class="kw1">using</span> pointer      <span class="sy1">=</span> <span class="coMULTI">/* 见描述 */</span><span class="sy4">;</span>
    <span class="kw1">using</span> element_type <span class="sy1">=</span> T<span class="sy4">;</span>
    <span class="kw1">using</span> deleter_type <span class="sy1">=</span> D<span class="sy4">;</span>
 
    <span class="co1">// 构造函数</span>
    <span class="kw4">constexpr</span> unique_ptr<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U<span class="sy1">&gt;</span> <span class="kw1">explicit</span> unique_ptr<span class="br0">(</span>U p<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U<span class="sy1">&gt;</span> unique_ptr<span class="br0">(</span>U p, <span class="coMULTI">/* 见描述 */</span> d<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U<span class="sy1">&gt;</span> unique_ptr<span class="br0">(</span>U p, <span class="coMULTI">/* 见描述 */</span> d<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    unique_ptr<span class="br0">(</span>unique_ptr<span class="sy3">&amp;&amp;</span> u<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U, <span class="kw1">class</span> E<span class="sy1">&gt;</span>
      unique_ptr<span class="br0">(</span>unique_ptr<span class="sy1">&lt;</span>U, E<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> u<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">constexpr</span> unique_ptr<span class="br0">(</span>nullptr_t<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="co1">// 析构函数</span>
    ~unique_ptr<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
 
    <span class="co1">// 赋值</span>
    unique_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span>unique_ptr<span class="sy3">&amp;&amp;</span> u<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U, <span class="kw1">class</span> E<span class="sy1">&gt;</span>
      unique_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span>unique_ptr<span class="sy1">&lt;</span>U, E<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> u<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    unique_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span>nullptr_t<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="co1">// 观察器</span>
    T<span class="sy3">&amp;</span> operator<span class="br0">[</span><span class="br0">]</span><span class="br0">(</span>size_t i<span class="br0">)</span> <span class="kw4">const</span><span class="sy4">;</span>
    pointer get<span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    deleter_type<span class="sy3">&amp;</span> get_deleter<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">const</span> deleter_type<span class="sy3">&amp;</span> get_deleter<span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">explicit</span> operator <span class="kw4">bool</span><span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="co1">// 修改器</span>
    pointer release<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U<span class="sy1">&gt;</span> <span class="kw4">void</span> reset<span class="br0">(</span>U p<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">void</span> reset<span class="br0">(</span>nullptr_t <span class="sy1">=</span> nullptr<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">void</span> swap<span class="br0">(</span>unique_ptr<span class="sy3">&amp;</span> u<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="co1">// 禁用从左值复制</span>
    unique_ptr<span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy3">&amp;</span><span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span>
    unique_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span><span class="kw4">const</span> unique_ptr<span class="sy3">&amp;</span><span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E7.B1.BB_std::bad_weak_ptr">类 <span class="t-lc"><a href="../memory/bad_weak_ptr.html" title="cpp/memory/bad weak ptr">std::bad_weak_ptr</a></span></span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">class</span> bad_weak_ptr <span class="sy4">:</span> <span class="kw1">public</span> exception <span class="br0">{</span>
  <span class="kw1">public</span><span class="sy4">:</span>
    bad_weak_ptr<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E7.B1.BB.E6.A8.A1.E6.9D.BF_std::shared_ptr">类模板 <span class="t-lc"><a href="../memory/shared_ptr.html" title="cpp/memory/shared ptr">std::shared_ptr</a></span></span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">class</span> shared_ptr <span class="br0">{</span>
  <span class="kw1">public</span><span class="sy4">:</span>
    <span class="kw1">using</span> element_type <span class="sy1">=</span> remove_extent_t<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy4">;</span>
    <span class="kw1">using</span> weak_type    <span class="sy1">=</span> weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy4">;</span>
 
    <span class="co1">// 构造函数</span>
    <span class="kw4">constexpr</span> shared_ptr<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">constexpr</span> shared_ptr<span class="br0">(</span>nullptr_t<span class="br0">)</span> <span class="kw1">noexcept</span> <span class="sy4">:</span> shared_ptr<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="br0">}</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      <span class="kw1">explicit</span> shared_ptr<span class="br0">(</span>Y<span class="sy2">*</span> p<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
      shared_ptr<span class="br0">(</span>Y<span class="sy2">*</span> p, D d<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y, <span class="kw1">class</span> D, <span class="kw1">class</span> A<span class="sy1">&gt;</span>
      shared_ptr<span class="br0">(</span>Y<span class="sy2">*</span> p, D d, A a<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> D<span class="sy1">&gt;</span>
      shared_ptr<span class="br0">(</span>nullptr_t p, D d<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> D, <span class="kw1">class</span> A<span class="sy1">&gt;</span>
      shared_ptr<span class="br0">(</span>nullptr_t p, D d, A a<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      shared_ptr<span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>Y<span class="sy1">&gt;</span><span class="sy3">&amp;</span> r, element_type<span class="sy2">*</span> p<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      shared_ptr<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>Y<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> r, element_type<span class="sy2">*</span> p<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    shared_ptr<span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      shared_ptr<span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>Y<span class="sy1">&gt;</span><span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    shared_ptr<span class="br0">(</span>shared_ptr<span class="sy3">&amp;&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      shared_ptr<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>Y<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      <span class="kw1">explicit</span> shared_ptr<span class="br0">(</span><span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>Y<span class="sy1">&gt;</span><span class="sy3">&amp;</span> r<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
      shared_ptr<span class="br0">(</span>unique_ptr<span class="sy1">&lt;</span>Y, D<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> r<span class="br0">)</span><span class="sy4">;</span>
 
    <span class="co1">// 析构函数</span>
    ~shared_ptr<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
 
    <span class="co1">// 赋值</span>
    shared_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      shared_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>Y<span class="sy1">&gt;</span><span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    shared_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span>shared_ptr<span class="sy3">&amp;&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      shared_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>Y<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
      shared_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span>unique_ptr<span class="sy1">&lt;</span>Y, D<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> r<span class="br0">)</span><span class="sy4">;</span>
 
    <span class="co1">// 修改器</span>
    <span class="kw4">void</span> swap<span class="br0">(</span>shared_ptr<span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">void</span> reset<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      <span class="kw4">void</span> reset<span class="br0">(</span>Y<span class="sy2">*</span> p<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
      <span class="kw4">void</span> reset<span class="br0">(</span>Y<span class="sy2">*</span> p, D d<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y, <span class="kw1">class</span> D, <span class="kw1">class</span> A<span class="sy1">&gt;</span>
      <span class="kw4">void</span> reset<span class="br0">(</span>Y<span class="sy2">*</span> p, D d, A a<span class="br0">)</span><span class="sy4">;</span>
 
    <span class="co1">// 观察器</span>
    element_type<span class="sy2">*</span> get<span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    T<span class="sy3">&amp;</span> operator<span class="sy2">*</span><span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    T<span class="sy2">*</span> operator<span class="sy2">-</span><span class="sy1">&gt;</span><span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    element_type<span class="sy3">&amp;</span> operator<span class="br0">[</span><span class="br0">]</span><span class="br0">(</span>ptrdiff_t i<span class="br0">)</span> <span class="kw4">const</span><span class="sy4">;</span>
    <span class="kw4">long</span> use_count<span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">explicit</span> operator <span class="kw4">bool</span><span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U<span class="sy1">&gt;</span>
      <span class="kw4">bool</span> owner_before<span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span> b<span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U<span class="sy1">&gt;</span>
      <span class="kw4">bool</span> owner_before<span class="br0">(</span><span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span> b<span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    shared_ptr<span class="br0">(</span>weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="br0">)</span> <span class="sy2">-</span><span class="sy1">&gt;</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy4">;</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> D<span class="sy1">&gt;</span>
    shared_ptr<span class="br0">(</span>unique_ptr<span class="sy1">&lt;</span>T, D<span class="sy1">&gt;</span><span class="br0">)</span> <span class="sy2">-</span><span class="sy1">&gt;</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E7.B1.BB.E6.A8.A1.E6.9D.BF_std::weak_ptr">类模板 <span class="t-lc"><a href="../memory/weak_ptr.html" title="cpp/memory/weak ptr">std::weak_ptr</a></span></span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">class</span> weak_ptr <span class="br0">{</span>
  <span class="kw1">public</span><span class="sy4">:</span>
    <span class="kw1">using</span> element_type <span class="sy1">=</span> remove_extent_t<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy4">;</span>
 
    <span class="co1">// 构造函数</span>
    <span class="kw4">constexpr</span> weak_ptr<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      weak_ptr<span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>Y<span class="sy1">&gt;</span><span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    weak_ptr<span class="br0">(</span><span class="kw4">const</span> weak_ptr<span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      weak_ptr<span class="br0">(</span><span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>Y<span class="sy1">&gt;</span><span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    weak_ptr<span class="br0">(</span>weak_ptr<span class="sy3">&amp;&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      weak_ptr<span class="br0">(</span>weak_ptr<span class="sy1">&lt;</span>Y<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="co1">// 析构函数</span>
    ~weak_ptr<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
 
    <span class="co1">// 赋值</span>
    weak_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span><span class="kw4">const</span> weak_ptr<span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      weak_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span><span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>Y<span class="sy1">&gt;</span><span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      weak_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>Y<span class="sy1">&gt;</span><span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    weak_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span>weak_ptr<span class="sy3">&amp;&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Y<span class="sy1">&gt;</span>
      weak_ptr<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span>weak_ptr<span class="sy1">&lt;</span>Y<span class="sy1">&gt;</span><span class="sy3">&amp;&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="co1">// 修改器</span>
    <span class="kw4">void</span> swap<span class="br0">(</span>weak_ptr<span class="sy3">&amp;</span> r<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">void</span> reset<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="co1">// 观察器</span>
    <span class="kw4">long</span> use_count<span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">bool</span> expired<span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> lock<span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U<span class="sy1">&gt;</span>
      <span class="kw4">bool</span> owner_before<span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span> b<span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> U<span class="sy1">&gt;</span>
      <span class="kw4">bool</span> owner_before<span class="br0">(</span><span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span> b<span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span>
    weak_ptr<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="br0">)</span> <span class="sy2">-</span><span class="sy1">&gt;</span> weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E7.B1.BB.E6.A8.A1.E6.9D.BF_std::owner_less">类模板 <span class="t-lc"><a href="../memory/owner_less.html" title="cpp/memory/owner less">std::owner_less</a></span></span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T <span class="sy1">=</span> <span class="kw4">void</span><span class="sy1">&gt;</span> <span class="kw1">struct</span> owner_less<span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> owner_less<span class="sy1">&lt;</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;&gt;</span> <span class="br0">{</span>
    <span class="kw4">bool</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span>, <span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">bool</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span>, <span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">bool</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span>, <span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> owner_less<span class="sy1">&lt;</span>weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;&gt;</span> <span class="br0">{</span>
    <span class="kw4">bool</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span>, <span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">bool</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span>, <span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">bool</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span>, <span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
 
  <span class="kw1">template</span><span class="sy1">&lt;&gt;</span> <span class="kw1">struct</span> owner_less<span class="sy1">&lt;</span><span class="kw4">void</span><span class="sy1">&gt;</span> <span class="br0">{</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
      <span class="kw4">bool</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span>, <span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
      <span class="kw4">bool</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span>, <span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
      <span class="kw4">bool</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span>, <span class="kw4">const</span> shared_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T, <span class="kw1">class</span> U<span class="sy1">&gt;</span>
      <span class="kw4">bool</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span>, <span class="kw4">const</span> weak_ptr<span class="sy1">&lt;</span>U<span class="sy1">&gt;</span><span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="kw1">using</span> is_transparent <span class="sy1">=</span> <span class="coMULTI">/* 未指明 */</span><span class="sy4">;</span>
  <span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E7.B1.BB.E6.A8.A1.E6.9D.BF_std::enable_shared_from_this">类模板 <span class="t-lc"><a href="../memory/enable_shared_from_this.html" title="cpp/memory/enable shared from this">std::enable_shared_from_this</a></span></span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">class</span> enable_shared_from_this <span class="br0">{</span>
  <span class="kw1">protected</span><span class="sy4">:</span>
    <span class="kw4">constexpr</span> enable_shared_from_this<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    enable_shared_from_this<span class="br0">(</span><span class="kw4">const</span> enable_shared_from_this<span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    enable_shared_from_this<span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span><span class="kw4">const</span> enable_shared_from_this<span class="sy3">&amp;</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    ~enable_shared_from_this<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
 
  <span class="kw1">public</span><span class="sy4">:</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> shared_from_this<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
    shared_ptr<span class="sy1">&lt;</span>T <span class="kw4">const</span><span class="sy1">&gt;</span> shared_from_this<span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span><span class="sy4">;</span>
    weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> weak_from_this<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    weak_ptr<span class="sy1">&lt;</span>T <span class="kw4">const</span><span class="sy1">&gt;</span> weak_from_this<span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
  <span class="kw1">private</span><span class="sy4">:</span>
    mutable weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> weak_this<span class="sy4">;</span>  <span class="co1">// 仅用于阐释</span>
  <span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E7.B1.BB.E6.A8.A1.E6.9D.BF_std::atomic_.E5.AF.B9_std::shared_ptr_.E7.9A.84.E7.89.B9.E5.8C.96">类模板 <span class="t-lc"><a href="../atomic/atomic.html" title="cpp/atomic/atomic">std::atomic</a></span> 对 <span class="t-lc"><a href="../memory/shared_ptr.html" title="cpp/memory/shared ptr">std::shared_ptr</a></span> 的特化</span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> atomic<span class="sy1">&lt;</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;&gt;</span> <span class="br0">{</span>
    <span class="kw1">using</span> value_type <span class="sy1">=</span> shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy4">;</span>
    <span class="kw4">static</span> <span class="kw4">constexpr</span> <span class="kw4">bool</span> is_always_lock_free <span class="sy1">=</span> <span class="coMULTI">/* 由实现定义 */</span><span class="sy4">;</span>
 
    <span class="kw4">bool</span> is_lock_free<span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">void</span> store<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired, memory_order order <span class="sy1">=</span> memory_order<span class="sy4">::</span><span class="me2">seq_cst</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> load<span class="br0">(</span>memory_order order <span class="sy1">=</span> memory_order<span class="sy4">::</span><span class="me2">seq_cst</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    operator shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> exchange<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired,
                           memory_order order <span class="sy1">=</span> memory_order<span class="sy4">::</span><span class="me2">seq_cst</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="kw4">bool</span> compare_exchange_weak<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> expected, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired,
                               memory_order success, memory_order failure<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">bool</span> compare_exchange_strong<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> expected, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired,
                                 memory_order success, memory_order failure<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="kw4">bool</span> compare_exchange_weak<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> expected, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired,
                               memory_order order <span class="sy1">=</span> memory_order<span class="sy4">::</span><span class="me2">seq_cst</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">bool</span> compare_exchange_strong<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> expected, shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired,
                                 memory_order order <span class="sy1">=</span> memory_order<span class="sy4">::</span><span class="me2">seq_cst</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="kw4">constexpr</span> atomic<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span> <span class="sy1">=</span> <span class="kw1">default</span><span class="sy4">;</span>
    atomic<span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    atomic<span class="br0">(</span><span class="kw4">const</span> atomic<span class="sy3">&amp;</span><span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span>
    <span class="kw4">void</span> operator<span class="sy1">=</span><span class="br0">(</span><span class="kw4">const</span> atomic<span class="sy3">&amp;</span><span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span>
    <span class="kw4">void</span> operator<span class="sy1">=</span><span class="br0">(</span>shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
  <span class="kw1">private</span><span class="sy4">:</span>
    shared_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> p<span class="sy4">;</span>            <span class="co1">// 仅用于阐释</span>
  <span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E7.B1.BB.E6.A8.A1.E6.9D.BF_std::atomic_.E5.AF.B9_std::weak_ptr_.E7.9A.84.E7.89.B9.E5.8C.96">类模板 <span class="t-lc"><a href="../atomic/atomic.html" title="cpp/atomic/atomic">std::atomic</a></span> 对 <span class="t-lc"><a href="../memory/weak_ptr.html" title="cpp/memory/weak ptr">std::weak_ptr</a></span> 的特化</span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> T<span class="sy1">&gt;</span> <span class="kw1">struct</span> atomic<span class="sy1">&lt;</span>weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;&gt;</span> <span class="br0">{</span>
    <span class="kw1">using</span> value_type <span class="sy1">=</span> weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy4">;</span>
    <span class="kw4">static</span> <span class="kw4">constexpr</span> <span class="kw4">bool</span> is_always_lock_free <span class="sy1">=</span> <span class="coMULTI">/* 由实现定义 */</span><span class="sy4">;</span>
 
    <span class="kw4">bool</span> is_lock_free<span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">void</span> store<span class="br0">(</span>weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired, memory_order order <span class="sy1">=</span> memory_order<span class="sy4">::</span><span class="me2">seq_cst</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> load<span class="br0">(</span>memory_order order <span class="sy1">=</span> memory_order<span class="sy4">::</span><span class="me2">seq_cst</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    operator weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> exchange<span class="br0">(</span>weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired,
                         memory_order order <span class="sy1">=</span> memory_order<span class="sy4">::</span><span class="me2">seq_cst</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="kw4">bool</span> compare_exchange_weak<span class="br0">(</span>weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> expected, weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired,
                               memory_order success, memory_order failure<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">bool</span> compare_exchange_strong<span class="br0">(</span>weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> expected, weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired,
                                 memory_order success, memory_order failure<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="kw4">bool</span> compare_exchange_weak<span class="br0">(</span>weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> expected, weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired,
                               memory_order order <span class="sy1">=</span> memory_order<span class="sy4">::</span><span class="me2">seq_cst</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    <span class="kw4">bool</span> compare_exchange_strong<span class="br0">(</span>weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="sy3">&amp;</span> expected, weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired,
                                 memory_order order <span class="sy1">=</span> memory_order<span class="sy4">::</span><span class="me2">seq_cst</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
    <span class="kw4">constexpr</span> atomic<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span> <span class="sy1">=</span> <span class="kw1">default</span><span class="sy4">;</span>
    atomic<span class="br0">(</span>weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    atomic<span class="br0">(</span><span class="kw4">const</span> atomic<span class="sy3">&amp;</span><span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span>
    <span class="kw4">void</span> operator<span class="sy1">=</span><span class="br0">(</span><span class="kw4">const</span> atomic<span class="sy3">&amp;</span><span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span>
    <span class="kw4">void</span> operator<span class="sy1">=</span><span class="br0">(</span>weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> desired<span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
  <span class="kw1">private</span><span class="sy4">:</span>
    weak_ptr<span class="sy1">&lt;</span>T<span class="sy1">&gt;</span> p<span class="sy4">;</span>              <span class="co1">// 仅用于阐释</span>
  <span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E7.B1.BB.E6.A8.A1.E6.9D.BF_std::out_ptr_t">类模板 <span class="t-lc">std::out_ptr_t</span></span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Smart, <span class="kw1">class</span> Pointer, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
  <span class="kw1">class</span> out_ptr_t <span class="br0">{</span>
  <span class="kw1">public</span><span class="sy4">:</span>
    <span class="kw1">explicit</span> out_ptr_t<span class="br0">(</span>Smart<span class="sy3">&amp;</span>, Args...<span class="br0">)</span><span class="sy4">;</span>
    out_ptr_t<span class="br0">(</span><span class="kw4">const</span> out_ptr_t<span class="sy3">&amp;</span><span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span>
 
    ~out_ptr_t<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
 
    operator Pointer<span class="sy2">*</span><span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    operator <span class="kw4">void</span><span class="sy2">**</span><span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
  <span class="kw1">private</span><span class="sy4">:</span>
    Smart<span class="sy3">&amp;</span> s<span class="sy4">;</span>                   <span class="co1">// 仅用于阐释</span>
    tuple<span class="sy1">&lt;</span>Args...<span class="sy1">&gt;</span> a<span class="sy4">;</span>           <span class="co1">// 仅用于阐释</span>
    Pointer p<span class="sy4">;</span>                  <span class="co1">// 仅用于阐释</span>
  <span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>
<h4><span class="mw-headline" id=".E7.B1.BB.E6.A8.A1.E6.9D.BF_std::in_out_ptr_t">类模板 <span class="t-lc">std::in_out_ptr_t</span></span></h4>
<div dir="ltr" class="mw-geshi" style="text-align: left;"><div class="cpp source-cpp"><pre class="de1"><span class="kw1">namespace</span> std <span class="br0">{</span>
  <span class="kw1">template</span><span class="sy1">&lt;</span><span class="kw1">class</span> Smart, <span class="kw1">class</span> Pointer, <span class="kw1">class</span>... <span class="me1">Args</span><span class="sy1">&gt;</span>
  <span class="kw1">class</span> inout_ptr_t <span class="br0">{</span>
  <span class="kw1">public</span><span class="sy4">:</span>
    <span class="kw1">explicit</span> inout_ptr_t<span class="br0">(</span>Smart<span class="sy3">&amp;</span>, Args...<span class="br0">)</span><span class="sy4">;</span>
    inout_ptr_t<span class="br0">(</span><span class="kw4">const</span> inout_ptr_t<span class="sy3">&amp;</span><span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span>
 
    ~inout_ptr_t<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
 
    operator Pointer<span class="sy2">*</span><span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
    operator <span class="kw4">void</span><span class="sy2">**</span><span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span>
 
  <span class="kw1">private</span><span class="sy4">:</span>
    Smart<span class="sy3">&amp;</span> s<span class="sy4">;</span>                   <span class="co1">// 仅用于阐释</span>
    tuple<span class="sy1">&lt;</span>Args...<span class="sy1">&gt;</span> a<span class="sy4">;</span>           <span class="co1">// 仅用于阐释</span>
    Pointer p<span class="sy4">;</span>                  <span class="co1">// 仅用于阐释</span>
  <span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div></div>

<!-- 
NewPP limit report
Preprocessor visited node count: 16559/1000000
Preprocessor generated node count: 14273/1000000
Post‐expand include size: 610869/2097152 bytes
Template argument size: 160080/2097152 bytes
Highest expansion depth: 23/40
Expensive parser function count: 0/100
-->

<!-- Saved in parser cache with key mwiki1-mwiki_zh_:pcache:idhash:9530-0!*!0!!zh!*!zh!* and timestamp 20211022195244 -->
</div>                    <!-- /bodycontent -->
                                        <!-- printfooter -->
                    <div class="printfooter">
                    来自“<a href="https://zh.cppreference.com/mwiki/index.php?title=cpp/header/memory&amp;oldid=72483">https://zh.cppreference.com/mwiki/index.php?title=cpp/header/memory&amp;oldid=72483</a>”                    </div>
                    <!-- /printfooter -->
                                                            <!-- catlinks -->
                    <!-- /catlinks -->
                                                            <div class="visualClear"></div>
                    <!-- debughtml -->
                                        <!-- /debughtml -->
                </div>
                <!-- /bodyContent -->
            </div>
        </div>
        <!-- /content -->
        <!-- footer -->
        <div id="cpp-footer-base" class="noprint">
            <div id="footer">
                        <div id="cpp-navigation">
            <h5>导航</h5>
            <ul><li><a href="https://zh.cppreference.com/w/cpp/header/memory">Online version</a></li><li>Offline version retrieved 2022-01-01 00:37.</li></ul></div>
                        <ul id="footer-info">
                                    <li id="footer-info-lastmod"> 本页面最后修改于2021年10月5日 (星期二) 07:53。</li>
                                    <li id="footer-info-viewcount">此页面已被浏览过15,311次。</li>
                            </ul>
                    </div>
        </div>
        <!-- /footer -->
        <script>if(window.mw){
mw.loader.state({"site":"loading","user":"missing","user.groups":"ready"});
}</script>
<script src="../../../common/skin_scripts.js"></script>
<script>if(window.mw){
mw.loader.load(["mediawiki.action.view.postEdit","mediawiki.user","mediawiki.page.ready","mediawiki.searchSuggest","mediawiki.hidpi","ext.gadget.MathJax","ext.gadget.ColiruCompiler"], null, true);
}</script>
<script src="../../../common/site_scripts.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2828341-1']);
_gaq.push(['_setDomainName', 'cppreference.com']);
_gaq.push(['_trackPageview']);
</script><!-- Served in 3.780 secs. -->
	</body>
<!-- Cached 20211022195244 -->
</html>